NoClassDefFoundError when GoogleAnalyticsTracker.getInstance()
I'm tring to use com.google.android.apps.analytics.GoogleAnalyticsTracker but got NoClassDefFoundError when
GoogleAnalyticsTracker.getInstance();
I'm sure that libGoogleAnalytics.jar is included in the Build Path and the code was successfully built.
that code worked perfectly before that I suspect that the error occur after I updated the ADT to the latest but no clue.
Could anybody give any suggestions on this?
Solution 1:
Actually this is the problem we are facing with ADT 17 you have to put your jar file into libs folder in order to overcome this exception
so right click on your project -->create a folder with name libs
and follow this step in
right click (on libs folder) -->import-->File System-->browse to select your jar file and hit finish and run you project.
after that
right click on the project --> Built Path-->java built path-->add jars select your jar file from your libs folder
Solution 2:
To solve the problem with the error NoClassdefFoundError when you are using the Google Analytics v2beta library, you need to mark this library as "exported".
How?
- Add your library: Project -> Properties -> Java Build Path -> Libraries -> Add External JARs...
- Then go to "Order and Export" in the same window, and mark this library as "exported" with the checkbox.
Your proyect will now find the Analytics class when you run it!
More details and why this happen here.