I have included the Google gdata finance jar in my Android project (included the jar file in the build set). However still when I make any calls to functions in that jar, I still get a NoClassDeffound Exception. I believe this means that during execution the particular class is not being found by the emulator. Any ways I can fix this problem?
And I am including the com.google.gdata.client.finance.* via the import statements.
UPDATE: I solved the problem. It was more gdata specific. The problem was that I was not including the core gdata files: gdata-client, gdata-client-meta, gdata-core, and gdata-media.
It would appear that your JAR is not being packaged with your application, for some reason. Make sure the JAR is in the libs/ directory of the project.
Related
I'm trying to use Google's Downloader Library and Application Licensing Service since my app is going to use APK Expansion. But the problem is I don't know how to add those 2 libraries to Android Studio. I always import libraries to Android Studio by File -> Import Module and then I select it.
But when I do that this time, it says:
Select modules to import
Even after I've already selected the Downloader Library or Licensing Library.
I also tried importing them by copying the directories to my app directory and then including them in gradle dependencies but that doesn't work either.
Could someone walk me through adding these 2 libraries to my Android Studio because I can't seem to figure it out.
For anyone else coming along with similar problem.
I solved it by importing module (File->New->Import Module) and selecting the licensing and the downloader library folders each time.
Note however that the .project file for downloader has a line that throws Android off (correctly):
android.library.reference.1=../market_licensing
Remove this line and the module imports fine.
Thank you Google once again for your clear instructions and clean environment!!!
BTW: What the heck are they writing in their guide
http://developer.android.com/google/play/expansion-files.html#AboutLibraries
"Select the Properties tab and in Library Repository, enter the
library from the /extras/google/ directory (play_licensing/ for
the License Verification Library or
play_apk_expansion/downloader_library/ for the Downloader Library)."
Does that even make any sense to anyone?!
I solved the problem in a very weird way.
I noticed that I can't import those 2 libraries directly to Android Studio because they are missing a lot of project files and therefore Android Studio doesn't recognize them as libraries.
I then imported both libraries to Eclipse so that everything neccessary was generated and then exported them directly to Android Studio.
That worked like a charm.
Maybe a weird way to import a library but at least it worked.
I just wanted to add a comment that the .project file for downloader should point to correct dependency:
android.library.reference.1=../../market_licensing/library
Now importing downloader will also import licensing which depends and create the correct dependency.
EDIT: That libraries are rather old. I've found new versions here:
https://github.com/google/play-apk-expansion
https://github.com/google/play-licensing
When I tried to import library, I met same issue, and I could resolve by adding 'include ':library-directory-name'
copy your library directory into your project
add "include ':library-directory-name'" in settings.gradle file same as include ':app'
For my internship (compagny without programmation skill), I have to use a trial library wich provides biometric algorithms from Neurotechnology compagny.
in fact the library contains .jar files. I added those files to my project and i used some class but there is the error : NoClassDefFoundError.
I supposed that i have to use the .so files which are also in the package from Neurotch. to definite class and method.
To do this, i installed NDK (with the Tegra android pack). But i never found tutorials on the internet that explain how to use foreign .so files to exploit those .jar in a Android Project
Please help.
You need not use ndk. Typicaly so locations:
I'm created a jar file for my appengine (python) application. I've followed the steps to import my library (.jar) files from this example. It seems Android Studio imported everything correctly (no error) until I try to use the classes in the library. I started to open up the classes that are contained in the jar files to see if everything looked to be in order. This is what I found:
UserMessage does not contain any errors.
Can anyone help explain why the classes can't see/use each other? Is this an issue with the jar or Android studio?
I had the same problem with Android Studio and Eclipse.
My solution is probably not the best and the easiest, but it works.
What I did is I extracted the code from the .jar file and placed it inside src.
Now I have something similar to the following structure:
I am trying to use Google's URL Shortening service in my Android app. I have imported the necessary jar files as mentioned here
I am following this as my reference to code from.
I am able to import the HTTPTransport class from com.google.api.client.http, but I am not able to import the GoogleTransport, GoogleHeaders, JsonHttpParser, nor Result, and JsonHttpContent doesn't seem to have the no-arg constructor given in the example I'm looking at.
Below is a screenshot of my project properties window, on the Libraries tab.
Copy all your jar files in your project libs folder. And remove these jars from Build Path Libraries as showing in image.
It turns out that you can use the Google Plugin for Eclipse to add an API to an Android project, as detailed here. Unfortunately, I still have the problem that I can't use the classes in any example I have found thus far. I guess I must just be using the library wrong.
I would like to integrate my app with a variety of file storage services. I followed the quickstart instructions for the Drive sdk, which adds a bunch of jars to my projects libs directory. Additionally, the Dropbox sdk requires the following list of jars:
commons-logging-1.1.1.jar
dropbox-android-sdk-1.5.3.jar
httpclient-4.0.3.jar
httpcore-4.0.1.jar
httpmime-4.0.3.jar
json-simple-1.1.jar
Once all of these are added to my project, I get the following error when I try to run:
Dex Loader] Unable to execute dex: Multiple dex files define
Lorg/apache/http/entity/mime/FormBodyPart;
If I remove the httpmime jar added for Dropbox, my project runs fine. But is this a safe way to resolve the conflict? Is there an alternative method with which I can build my project and include all the required jars?
Assuming no version conflicts this would work fine. Compare the httpmime-4.0.3.jar to the httpmime jar that Drive added to your libs directory. If they're the same, then it's fine. If they're different, then you'll have to find out the differences between the two and insure that they're not breaking changes. As a last resort you could also repackage one of the SDKs with its required version of httpmime in a jar selectively obfuscated with ProGuard, though that's a hassle.
If you are developing with Eclipse, consider using Google Plugin for Eclipse. It provides a way to add any of the Google's SDK to your app. All the jars are added automatically.