I want to use Jade as standalone in Android environment.
Of course I'm using JadeLeapAndroid 4.3.3
I found these posts which was very helpful,
http://permalink.gmane.org/gmane.comp.java.jade.devel/12271
http://jade.tilab.com/pipermail/jade-develop/2013q1/018940.html
but I have a problem now.
I can bind service via this code.
[code starts here]
public void bind() {
sc = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d("SERVICE", "Bind Success");
binder = (RuntimeServiceBinder) service;
container();
}
@Override
public void onServiceDisconnected(ComponentName name) {
Log.d("SERVICE", "Bind Fail");
binder = null;
}
};
Log.d("SERVICE", "Bind Trial");
bindService(new Intent(getApplicationContext(), RuntimeService.class),
sc, Context.BIND_AUTO_CREATE);
}
[code ends here]
But when I continues with AgentContainer with this code,
[code starts here]
public void container() {
Profile profile = new ProfileImpl();
binder.createAgentContainer(profile, new RuntimeCallback<AgentContainerHandler>() {
@Override
public void onSuccess(AgentContainerHandler agentContainerHandler) {
try {
Log.d("CONTAINER", "Startup Success");
ContainerController cc = agentContainerHandler.getAgentContainer();
//AgentController ac = cc.getAgent("Arin");
AgentController ac = cc.createNewAgent("TestAgent", TestAgent.class.getName(),
new Object[] { new Object() });
ac.start();
//agent(agentContainerHandler);
} catch (ControllerException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(Throwable throwable) {
Log.d("CONTAINER", "Startup Fail");
}
});
}
[code ends here]
it shows error on FileNotFound (EROFS) exception.
(It occurs even I deleted all codes in onSuccess method)
[error starts here]
06-23 01:24:26.423 25603-25627/com.jadeandroid.test.jadeandroid E/jade.core.messaging.Messaging﹕ Error writing platform address
java.io.FileNotFoundException: MTPs-Main-Container.txt: open failed: EROFS (Read-only file system)
at libcore.io.IoBridge.open(IoBridge.java:456)
at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
at java.io.FileOutputStream.<init>(FileOutputStream.java:72)
at java.io.FileWriter.<init>(FileWriter.java:80)
at jade.core.messaging.MessagingService.boot(MessagingService.java:326)
at jade.core.AgentContainerImpl.bootAllServices(AgentContainerImpl.java:468)
at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:408)
at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:495)
at jade.core.Runtime.createMainContainer(Runtime.java:166)
at jade.android.RuntimeService$7.run(RuntimeService.java:278)
Caused by: android.system.ErrnoException: open failed: EROFS (Read-only file system)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
at libcore.io.IoBridge.open(IoBridge.java:442)
at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
at java.io.FileOutputStream.<init>(FileOutputStream.java:72)
at java.io.FileWriter.<init>(FileWriter.java:80)
at jade.core.messaging.MessagingService.boot(MessagingService.java:326)
at jade.core.AgentContainerImpl.bootAllServices(AgentContainerImpl.java:468)
at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:408)
at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:495)
at jade.core.Runtime.createMainContainer(Runtime.java:166)
at jade.android.RuntimeService$7.run(RuntimeService.java:278)
06-23 01:24:26.441 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ java.io.FileNotFoundException: APDescription.txt: open failed: EROFS (Read-only file system)
06-23 01:24:26.441 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ at libcore.io.IoBridge.open(IoBridge.java:456)
06-23 01:24:26.441 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
06-23 01:24:26.441 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ at java.io.FileOutputStream.<init>(FileOutputStream.java:72)
06-23 01:24:26.442 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ at java.io.FileWriter.<init>(FileWriter.java:80)
06-23 01:24:26.442 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ at jade.domain.ams.writeAPDescription(ams.java:1435)
06-23 01:24:26.442 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ at jade.domain.ams.setup(ams.java:144)
06-23 01:24:26.442 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ at jade.core.Agent$ActiveLifeCycle.init(Agent.java:1542)
06-23 01:24:26.442 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ at jade.core.Agent.run(Agent.java:1488)
06-23 01:24:26.442 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ at java.lang.Thread.run(Thread.java:818)
06-23 01:24:26.442 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ Caused by: android.system.ErrnoException: open failed: EROFS (Read-only file system)
06-23 01:24:26.442 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ at libcore.io.Posix.open(Native Method)
06-23 01:24:26.442 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
06-23 01:24:26.442 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ at libcore.io.IoBridge.open(IoBridge.java:442)
06-23 01:24:26.442 25603-25644/com.jadeandroid.test.jadeandroid W/System.err﹕ ... 8 more
[error ends here]
Actually, this is Permission error from Android that prevents app from write file to /system or /data even I added permission of WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE.
What should I do?
I'm guessing it might be a problem of profile, am I right?
Thanks in advance
For someone needs help on this, you can change path with Profile
for example,
Of course, make sure that add permission in manifest
But it doesn't matter whether you do it or not for executing JADE container