I am using the java-ipfs-api - https://www.npmjs.com/package/geth-private for my android DApp. I have managed to connect to the ipfs daemon and have tested it using the ipfs.refs.local(); command as stated on the github. However, when I try to add a file with
NamedStreamable.ByteArrayWrapper ipfsFile = new NamedStreamable.ByteArrayWrapper(usr + ".txt", userJSON.toString().getBytes());
MerkleNode addFile = ipfs.add(ipfsFile);
or even with
NamedStreamable.FileWrapper file = new NamedStreamable.FileWrapper(new File("hello.txt")); MerkleNode addResult = ipfs.add(file);
as given on the github page it just used the Adnroid Looper class and loops indefinitely and crashes. Can't find anything on the github about this or in the code. Can anyone help please? Thanks.
-- EDIT
FATAL EXCEPTION: main Process: benkrarup.ethereum.messagingdapp, PID: 24710 java.lang.NoClassDefFoundError: Failed resolution of: Ljava/nio/file/Paths; at io.ipfs.api.IPFS.add(IPFS.java:85) at io.ipfs.api.IPFS.add(IPFS.java:70) at benkrarup.ethereum.messagingdapp.RegisterActivity$1.onClick(RegisterActivity.java:91) at android.view.View.performClick(View.java:5610) at android.view.View$PerformClick.run(View.java:22265) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) Caused by: java.lang.ClassNotFoundException: Didn't find class "java.nio.file.Paths" on path: DexPathList[[zip file "/data/app/benkrarup.ethereum.messagingdapp-2/base.apk"],nativeLibraryDirectories=[/data/app/benkrarup.ethereum.messagingdapp-2/lib/x86, /data/app/benkrarup.ethereum.messagingdapp-2/base.apk!/lib/x86, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:380) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at io.ipfs.api.IPFS.add(IPFS.java:85) at io.ipfs.api.IPFS.add(IPFS.java:70) at benkrarup.ethereum.messagingdapp.RegisterActivity$1.onClick(RegisterActivity.java:91) at android.view.View.performClick(View.java:5610) at android.view.View$PerformClick.run(View.java:22265) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
It's getting this error.