Android Unable to Instantiate Activity: Didn't Find Class on Path

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{…}: java.lang.ClassNotFoundException: Didn't find class

Since your exception is:

ClassNotFoundException: Didn't find class "com.kpbird.fusedlocation.MainActivity"

into your AndroidManifest.xml add the complete package were your activity is located:

<activity
android:name="com.kpbird.fusedlocation.MainActivity"

or be sure to have to correct package name defined:

package="com.kpbird.fusedlocation"

I think you typed incorrectly the package of your application in some place of your code!

Sample Image

Unable to instantiate activity ... Didn't find class WelcomeActivity on path: DexPathList (with instant run)

It looks like a bug in the build tools version 24.0.2, I upgraded to 24.0.3 and finally got it working again!

buildToolsVersion '24.0.3'

Rolling back to 24.0.2 reproduces the problem every time.

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{}: java.lang.ClassNotFoundException

because you are declare this way

  <activity
android:name="MainActivity"

just put . to MainActivity like this

 <activity
android:name=".MainActivity"

Android Unable to instantiate activity: Didn't find class on path

I suppose you're using Eclipse. Your activity is there alright, but Eclipse didn't include the support package in the APK ... If you look above your error in stacktrace you will notice the root of your problem: "Unable to find FragmentActivity". Or you can unpack the apk, undex it and you will see the compatibility package classes were not included.

To fix this, right-click your project, properties, build path and go to export tab. There make sure "Android private libraries" are checked. A clean and rebuild should put you on track ...



Related Topics



Leave a reply



Submit