I have imported a .jar into my Eclipse Android project (importing it to the libs folder and adding the jar to the libraries in Java Build Path), but when I attempt to use it, I get a java.lang.VerifyError. The library is Jiwigo 0.13.1.1; a java library for accessing Piwigo image galleries. I know this should work, because there's an open source android project called RegalAndroid that uses it too (though, an older version, and it copied the source instead of properly importing it). The .jar is the only copy of the library on my computer, so I'd be surprised if it was a version clash error. Any ideas?
Here's my error log (shortened because all the rest is normal android stuff):
FATAL EXCEPTION: main
java.lang.VerifyError: fr.mael.jiwigo.transverse.session.SessionManager
at com.terrapages.itemdetailsactivities.FavoritesDetailsActivity.initViews(FavoritesDetailsActivity.java:179)
at com.terrapages.itemdetailsactivities.FavoritesDetailsActivity.onResume(FavoritesDetailsActivity.java:83)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
at android.app.Activity.performResume(Activity.java:3823)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)
[...]
And the line it crashes on (with dummy string values that are different in the code):
SessionManager sessionManager = new SessionManager("username", "password", "gallery-url");
This is the first use of the library anywhere in the code.
I'm the developer of Jiwigo and read this post this afternoon by chance.
As I do not develop on Android, I didn't even know that my api was not compatible with android.
So after I read this post, I made some changes on my API : I replaced the old Apache HttpClient version with a newest one : 4.1 (I think it's compatible with android isn't it ?)
And I removed all JDom references. The code now uses org.w3c.dom.Document instead. The jar is here : http://maven.le-guevel.com/artifactory/libs-release-local/fr/mael/jiwigo/jiwigo-ws-api/0.2b/
As I said, I just made the modifications this afternoon, and I did not test it very well, so it could be unstable (it seems to work on my project).
Bye.
Any ideas?
SessionManager is using a class or method that does not exist in Android. Assuming this is the source for the class in question, there is no way that will work on Android without substantial modifications, as it uses:
an old version of Apache HttpClient
JDOM
neither of which are in Android.
I had a similar issue with my projects after doing the Android ADT , and Java updates.
Try these steps
Remove links to your external libraries in your Android project.
Move all your external libraries (including Google Ad libraries) to \libs folder inside your Android project.
Re-link your libraries, that now exist in the Project\libs directory.
Hopefully this will help
Related
I've seen that the android support library appcompat v4 takes actually about 1Mo on my final apk while I only use it to create Notifications with NotificationCompat.
I use a .jar of the library.
Since the source code is available (https://github.com/android/platform_frameworks_support/tree/master/v4/java/android/support/v4) do you think it would help if I include the source code in my project instead of the .jar file? So the compiler would only include the necessary files.
Is it bad practice to do that?
In my application i got the same problem as you: a huge jar file to use just a single class. I copied the sources of LocalBroadcastManager to my application and everything worked fine.
How do I install this API (https://github.com/socrata/soda-java) in order to use it in an Android project? This seems to be a "left to the student as an exercise" hole in their documentation, while all the usages of the various objects in the API are well-documented and exampled in the readme.md
The one video I could find (https://www.youtube.com/watch?v=G27zMPLZm6o) was on Mac using a jar. But this API is published in a Zip, which I can paste under app\libs but 'Add as library' won't show up in the right-click menu from there.
The readme hints that:
soda-java is published to Maven Central. The dependency is
(dependency)
(groupId)com.socrata(/groupId)
(artifactId)soda-api-java(/artifactId)
(version)0.9.12(/version)
(/dependency)
Note: all those parens are actually > and <, and the text is indented, none of which showed up when I pasted it here as it is in the readme.
But I have no idea what that means? I don't know where Maven fits in the world. Am I calling out from my project, like a gem in Ruby? But the video has me copying the actual Zip file locally and installing it in my project. (Git wanted to know if I wanted to include tracking that Zip.)
Morrison's comments about the issues with Jersey and Android aside, there's a release in Github available as a pre-compiled JAR file, I'd start with that:
https://github.com/socrata/soda-java/releases/tag/v0.9.12
There's also the soda-android library as well, which might be more appropriate:
https://github.com/socrata/soda-android-sdk
You would have to port it.
A quick look at the source here: https://github.com/socrata/soda-java/blob/master/src/main/java/com/socrata/api/HttpLowLevel.java
and this line shows that Socrata is using the Jersey project:
import com.sun.jersey.api.client.Client;
A bit of searching and it appears to be the 1.x version of Jersey and the only thing that I could find related to Android and Jersey is this blog entry with the author trying to get Jersey 2.16 working on Android:
https://blogs.oracle.com/japod/entry/jersey_2_x_client_on
To be clear I've never used these libraries so I have no I idea how hard it would be to port over and made to work on Android as Android Java isn't exactly the same as Oracle/Sun J2SE Java (missing packages, etc.).
I took the Library source code directly from https://github.com/azure/azure-storage-java for android
Added the code to my existing library project. Everything seems fine expect that it gives errors in files like OperationContext.java asking me to import org.slf4j.Logger
From the documentation it is clear that the library is optional. Why then should I use the library, is there anyway to build this library without the use of SLF4J library?
Do i have to modify the source code to build it ?
If you're looking for the Azure Storage Android Client Library, it is located at https://github.com/Azure/azure-storage-android and not the location you linked.
Adding the Android source code to your existing library project should be successful without any modifications.
I am new to eclipse scala and android but I've been trying to build a scala android application and run it successfully for some time now. I found this plugin that is supposed to allow me to do that but I can't seem to make heads or tails of it.
I read the readme. I downloaded it. I copied the contents of the bin folder to the dropins folder of my eclipse instalation( which includes the sdk which includes the plugin development tools which were a requirement). I manually added the nature to the project file.
Now what?
I still can't reference scala classes from my java android app.
I guess what I am trying to ask is: How do I know when the thing is installed?
and
How do I work with it after adding the nature? Do i make an android project add the nature and then reference a scala project to it?
Did I add the nature ok in the first place?
Thanks
I had some luck with that some time ago, I think the trick was to create a main class in Java and immediately hand over the control to a scala class instead :)
I am developing a library for Android applications which does not use native code (JNI). I have tried suppling the library as an external jar in my Android projects but this method does not include the library contents in the apk and thus throws class not found errors when run in the emulator or device. I have also tried creating the library as an Android project in itself and this does work, but only for public static properties (not methods). With the library and application both being in separate apk's I can see that the VM notices references to the library and can read some properties, but when an attempt to instantiate a class in the library is executed I get class not found even though I can read the public static properties from it (very frustrating!!).
I realize that Davlik byte code is not the same as Java byte code but I am having trouble even finding good information about how to solve what would seem to be a very simple issue in Android. I am looking into the old PlatformLibrary stuff right now but I am not convinced this will work either since the sample has been removed from the Android site :(
So help me out if you can, if I find the answer before this happens I will share it.
viva la Android!
I have tried suppling the library as
an external jar in my Android projects
but this method does not include the
library contents in the apk and thus
throws class not found errors when run
in the emulator or device.
Put the JAR in your libs/ directory, and it will automatically be included in the APK.
This sample project from one of my books shows using the BeanShell JAR this way. Also, all of the GitHub repos starting with "cwac-" on my GitHub page are projects designed to build JARs to be included in Android projects via the libs/ directory.