Android Activity Classnotfoundexception - Tried Everything

Android Activity ClassNotFoundException - tried everything

I spent some time play with my own project, and I am able to replicate your problem and get exactly the same exception stack trace when trying to run my main project, so I think this could be the cause:

Just like what I thought, it is all about how you reference your Android library project in the Android main project, a simple Eclipse configuration settings.

The Wrong Way:

Right click main project, choose Properties -> Java Build Path -> Projects -> Add..., this add the Android library Project as a dependency project in Android main project's build path, this does not work. If all required Android-related resources are defined in main project, you will not get any error at compile time, but when run the application, you get the exception described in the question.

The Correct Way:

Right click main project, choose Properties -> Android, in the Library section, add your Android library project here. Check out official dev guide Referencing a library project. This should fix all your problem. Also note that you have to use relative path reference the actual Android library project, as stated in the Library Project - Development considerations.

Hope this helps.

Java.lang.ClassNotFoundException after Android studio update

Try this:

Clear app cache

Clear app data

Uninstall app

Run/Debug again

Hope it works!

Android Activity: ClassNotFoundException

You are setting the application node to reference a nonexistent class

de.bastian.gpstracker

Refers to the package name, no class whatsoever. Since gpstracker is the last thing in that string, the class loader assumes that gpstracker is a class, tries to load it and fails.

So write the name of the Application class (which extends Application).

Eg

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="de.bastian.gpstracker.MyApplicationClass" >

If you don't have a class that extends Application, then take out the android:name attribute for this node so it looks just like:

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >

ClassNotFoundException: if Android App downloaded from play store

I was including appcombat v7 in wrong way. A correct way is given here.



Related Topics



Leave a reply



Submit