I’m struggling on a problem on my new Android C2DM test project:
Android Engine Connected Android Project.
The problem is:
At LogCat:
04-04 19:35:09.414: E/AndroidRuntime(320): java.lang.NoClassDefFoundError:
com.google.android.c2dm.C2DMessaging
Location at debug window: InvocationTargetException.class
InvocationTargetException.(Thrownable) Line 50
Exception: NoClassDefFoundError
Does any one have any idea what file (and where) I’m missing and how to fix?
Know where/how to get Google API source for debugging?
Really appreciate your inputs.
The problem is that the latest ADT doesn't allow libraries (.jar) in any other folder except "libs" so please rename the folder from "lib" to "libs" and then add the existing three libraries (.jar) again.
Related
I'm trying to run Vuforia SDK samples from here on Android:
I have already downloaded the main SDK and put those sample files in the sample folder. I have added the Vuforia.jar as a library and dependency to my project. The app runs on my Samsung S4 and shows the Menu but when I click Start on any of the examples it sends me back to the main menu rather than opening the camera. It doesn't show any crash error in the logs.
I'm wondering if anyone has experienced this problem and has managed to fix it?
I had the same issue and when looked at the log it had this message com.vuforia.samples.VuforiaSamples W/System.err: The library libVuforia.so could not be loaded
Then I followed the answer here https://developer.vuforia.com/forum/android/crash-start-button-sample
and that .jar file to the project. This solved the above issue.
Also I had to generate a license key for the app and set it in the last parameter in Vuforia.setInitParameters(mActivity, mVuforiaFlags, "") in the SampleApplicationSession class
try it:
add the Vuforia.jar lib in your project;
go to archive build.gradle (Module:app) and check if the variable 'VUFORIA_SDK_DIR' is correct (in my project it had the value "../../../" but i had to change to "../../"), the path has to lead to your Vuforia SDK dir;
finally, change the method Vuforia.setInitParameters in the archive SampleApplicationSession.java (line: 414), add your vuforia key in the third paramether;
it works to me
I am using parse-1.9.3.jar file in my eclipse tool for android development, but i am facing the noclassdeffoundexception while am running my app and my app is crashed. How to fix this issue, i am very much struggle in this point.
I followed some points
I download the parse-1.9.3.jar, copy and paste in lib folder then right click on that parse-1.9.3.jar file then i clicked add to build, this way is not working
Right click project--> project properties--> order and export tab --> checked android private libraries and parse-1.9.3.jar file, this way not worked
java.lang.NoClassDefFoundError: com.parse.Parse --> no use
Libraries do not get added to APK anymore after upgrade to ADT 22 --> NO use
NoClassDefFoundError with parse -->no use
https://en.wikipedia.org/wiki/Classpath_%28Java%29 this is also no use
Please help for how to fix this error and run my app successfully
Thanks in advance
I'm following the Google Drive Quickstart on Android instructions and have it working in Eclipse/Kepler. (Juno is just plain dodgy.) However, I'm much more familiar with IntelliJ, so I'm trying to figure out how to install these APIs there in a corresponding manner.
I think I'm getting tripped up on the Drive API part. The Eclipse plugin installs Drive in some special way or place. I added Google-api-services-drive-v2-rev63-1.14.1-beta.jar as a library, same as the others (Google-play-services and the api_java_client). But when I run the application it comes back with
java.lang.NoClassDefFoundError: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential
And I've also gotten a NoClassDefFoundError having to do with Drive$Builder.
In IntelliJ the .jar scopes are set to "Compile" except for the api_java_client libraries which are set to "Provided." None of them have "Export" checked.
Edit: added the module & dependency. I now have a different error:
04-07 00:39:59.766: ERROR/AndroidRuntime(10697): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError:
com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential
at com.fallinghawks.weight4.App.onCreate(App.java:15)
App.java:15 is
credential = GoogleAccountCredential.usingOAuth2(this, DriveScopes.DRIVE);
I can find the class it's asking for....
Edit 2, after adding libraries per CrazyCoder's instructions:
It compiles, it runs, but I get the following error. I am sure I missed doing something exactly right, I'll try it again in a minute but in the meantime the error is:
04-10 18:02:35.120: ERROR/AndroidRuntime(740): FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at com.google.api.services.drive.Drive$Builder.build(Drive.java:7301)
at com.example.DriveQuickstart.MyActivity.getDriveService(MyActivity.java:110)
at com.example.DriveQuickstart.MyActivity.onActivityResult(MyActivity.java:49)
at android.app.Activity.dispatchActivityResult(Activity.java:5293)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3315)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3362)
at android.app.ActivityThread.access$1100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.google.common.base.Preconditions
at com.google.api.services.drive.Drive.<clinit>(Drive.java:63)
(Hopefully final edit): Yes, I missed something and the beast is working! Thank you so much!!
Now I can use IntelliJ again to work on my "real" project... sooooo much better :)
I went ahead and created IntelliJ IDEA project from scratch, spent about 15 minutes, works just fine.
Download Drive API v2 library and dependencies.
Unpack it somewhere, open readme.html, spend a couple of minutes reading it to understand what jars are needed.
Create a new Android application project in IDEA using a wizard with com.example.drivequickstart package and MainActivity. Use Android 4.2.2 Google APIs as the Platform.
Copy the following jars from the downloaded Drive API library into the project libs folder (you should have learned which jars to use from the step 2):
google-api-client-1.14.1-beta.jar
google-api-client-android-1.14.1-beta.jar
google-http-client-1.14.1-beta.jar
google-http-client-android-1.14.1-beta.jar
google-http-client-gson-1.14.1-beta.jar
google-oauth-client-1.14.1-beta.jar
gson-2.1.jar
jsr305-1.3.9.jar
google-api-services-drive-v2-rev65-1.14.1-beta.jar
Configure a project library from these jars. It can be done by selecting the jars in the Project View, right click, Add as Library..., add this library to the dependencies of your main module.
File | Import Module, browse to ANDROID_SDK\extras\google\google_play_services\libproject\google-play-services_lib, from the existing sources.
Add google-play-services.jar to the dependencies of the imported module, enable the Export checkbox, it should look like this.
Add the module created in step 6 to the dependencies of your main application module.
Copy MainActivity sample code from the Quick Start, step 4 into the MainActivity.java file replacing the old code, edit AndroidManifest.xml as well per the guide.
Build, run in the emulator or on the device to test (don't forget steps 1-2 from the Quick Start).
Or you can just download and use the completely isolated sample that I've created following the above steps (module from the step 6 is included in the project).
It failed for me in the emulator because of some Camera app error (the sample uses Camera and my emulator didn't have it configured), but worked on the Galaxy Nexus device. The sample takes a picture using the device camera and uploads it to your Google Drive.
04-02 21:45:18.260: E/AndroidRuntime(17850): Caused by: java.lang.NoClassDefFoundError: com.capstonecontrol.client.ModulesRequestFactory
Is the error I get when ever my android app tries to use any request factory object. Everything was working until I updated the plugins for eclipse and now I cant seem to get anything to work. Eclipse was giving me an error about my requestfactory-apt.jar file so I removed it from the factory path and added the jar again and that cleared the compile error. But now I get the error above.
I even tried to create a whole new android linked app engine project and just test out the default app and I get the same error. Any help would be greatly appreciated. Thanks!
The new ADT tools require the external jar files to be placed within a folder called "libs" at the root of your project.
Once you move your external libraries there, they will be automatically detected by the tools, included in your build path and your application will work as normal.
I was trying to do a simple app using the Google Tasks API. Something simple it's turning into a nightmare. Maybe it's something simple, probably it is, but I can't figure it out.
The problem: I was following the example of TasksSample.java from Google but I can't compile even after importing the libraries and dependencies required. I'm using Google API Java Client version 1.5.0.
The problem it's when I access the GoogleAccessProtectedResource class. The import is:
import com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAccessProtectedResource;
I always, and I mean always, no matter what code I have get the following error:
09-26 03:14:38.372: ERROR/dalvikvm(18731): Could not find class 'com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAccessProtectedResource', referenced from method com.greven.test.google.tasks.GoogleTasksTake100Activity.
09-26 03:14:38.402: ERROR/AndroidRuntime(18731): FATAL EXCEPTION: main
09-26 03:14:38.402: ERROR/AndroidRuntime(18731): java.lang.NoClassDefFoundError: com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAccessProtectedResource
I really can't see where the problem is. I imported all the needed .jars... I guess
As you can see in this picture the class is obviously imported:
So what other options do I have to fix this? Use Maven? I'm clueless now. I never thought I would have a problem like this. Oh I also tested on different computers, other Google java api client (version 1.4) and same thing happened. Thanks in advance.
It seems as per your screenshot that your imported jar is imported in Eclipse, however for your Android application to work you need these jars to be dropped into a specific folder so that it is added to your APK and so the emulator and the Android devices find it.
It seems you should drop these jars in a folder named /libs at the root of your project. See this SO question: How can I use external JARs in an Android project?
The Article you are referring too uses the /assets folder but this might have changed a few Android versions ago.