1

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.

1 Answer 1

0

I know this is late but I did create an implementation of IPFS that works with android. It is because java.nio.Paths is not available at API level 24.

-- I have posted a link on the github for the available code however it is a quick untested fix.

1
  • Can you share a link to your fix here, so it can help others?
    – Ismael
    Commented Nov 9, 2017 at 4:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.