posted 5 years ago
Hello,
I am working on a project in android, where I am trying to upload any file from my phone to my private cloud. So, for that I am using swift joss API.
I have imported the dependency: compile 'org.javaswift:joss:0.9.14' in build.gradle file.
When I compile it get 2 warnings:
Warning:Dependency org.apache.httpcomponents:httpclient:4.2.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.2.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
I anyways proceeded to run the code. But I get run time error every time while uploading the file.
The error is :
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: FATAL EXCEPTION: Thread-13339
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: Process: com.hfad.jossdemo, PID: 2758
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: java.lang.NoSuchMethodError: No direct method <init>(Ljava/io/File;)V in class Lorg/apache/http/entity/FileEntity; or its super classes (declaration of 'org.apache.http.entity.FileEntity' appears in /system/framework/org.apache.http.legacy.boot.jar)
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: at org.javaswift.joss.instructions.UploadPayloadFile.getEntity(UploadPayloadFile.java:20)
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: at org.javaswift.joss.instructions.UploadInstructions.getEntity(UploadInstructions.java:130)
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: at org.javaswift.joss.swift.SwiftStoredObject.uploadObject(SwiftStoredObject.java:79)
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: at org.javaswift.joss.swift.Swift.uploadObject(Swift.java:330)
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: at org.javaswift.joss.command.mock.object.UploadObjectCommandMock.callSwift(UploadObjectCommandMock.java:28)
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: at org.javaswift.joss.command.mock.core.CommandMock.call(CommandMock.java:62)
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: at org.javaswift.joss.client.core.AbstractStoredObject.directlyUploadObject(AbstractStoredObject.java:202)
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: at org.javaswift.joss.client.core.AbstractStoredObject.uploadObject(AbstractStoredObject.java:145)
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: at org.javaswift.joss.client.core.AbstractStoredObject.uploadObject(AbstractStoredObject.java:214)
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: at com.hfad.jossdemo.MainActivity$2.run(MainActivity.java:126)
06-07 07:59:59.243 2758-3194/com.hfad.jossdemo E/AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
The line of code where the error traces back to is:
someFile.uploadObject(new File(file_path));
What I can gather till now is that, there is some kind of difference in the files that are being used at compile and run time. Or there are different versions of files being used at different places.
I am new to android and unable to locate where the fault lies.
Any valuable suggestions are welcome! Please help.
Thanks!