Srikanth Chilukuri
Srikanth Chilukuri

Reputation: 573

Unable to load activity on Android Emulator?

Recently, I have updated Android SDK with Latest Tools(Rev. 17). I am using Pahonegap 1.3.0

When I am loading page, I am not getting anything on emulator and got the below error

> 04-02 18:49:31.312: W/dalvikvm(1689): Unable to resolve superclass of
> Lcom/src/test1/Test1Activity; (4) 04-02 18:49:31.362:
> W/dalvikvm(1689): Link of class 'Lcom/src/test1/Test1Activity;' failed
> 04-02 18:49:31.362: D/AndroidRuntime(1689): Shutting down VM 04-02
> 18:49:31.402: W/dalvikvm(1689): threadid=1: thread exiting with
> uncaught exception (group=0x409c01f8) 04-02 18:49:31.522:
> E/AndroidRuntime(1689): FATAL EXCEPTION: main 04-02 18:49:31.522:
> E/AndroidRuntime(1689): java.lang.RuntimeException: Unable to
> instantiate activity
> ComponentInfo{com.src.test1/com.src.test1.Test1Activity}:
> java.lang.ClassNotFoundException: com.src.test1.Test1Activity 04-02
> 18:49:31.522: E/AndroidRuntime(1689):     at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
> 04-02 18:49:31.522: E/AndroidRuntime(1689):   at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
> 04-02 18:49:31.522: E/AndroidRuntime(1689):   at
> android.app.ActivityThread.access$600(ActivityThread.java:123) 04-02
> 18:49:31.522: E/AndroidRuntime(1689):     at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
> 04-02 18:49:31.522: E/AndroidRuntime(1689):   at
> android.os.Handler.dispatchMessage(Handler.java:99) 04-02
> 18:49:31.522: E/AndroidRuntime(1689):     at
> android.os.Looper.loop(Looper.java:137) 04-02 18:49:31.522:
> E/AndroidRuntime(1689):   at
> android.app.ActivityThread.main(ActivityThread.java:4424) 04-02
> 18:49:31.522: E/AndroidRuntime(1689):     at
> java.lang.reflect.Method.invokeNative(Native Method) 04-02
> 18:49:31.522: E/AndroidRuntime(1689):     at
> java.lang.reflect.Method.invoke(Method.java:511) 04-02 18:49:31.522:
> E/AndroidRuntime(1689):   at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
> 04-02 18:49:31.522: E/AndroidRuntime(1689):   at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 04-02
> 18:49:31.522: E/AndroidRuntime(1689):     at
> dalvik.system.NativeStart.main(Native Method) 04-02 18:49:31.522:
> E/AndroidRuntime(1689): Caused by: java.lang.ClassNotFoundException:
> com.src.test1.Test1Activity 04-02 18:49:31.522:
> E/AndroidRuntime(1689):   at
> dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
> 04-02 18:49:31.522: E/AndroidRuntime(1689):   at
> java.lang.ClassLoader.loadClass(ClassLoader.java:501) 04-02
> 18:49:31.522: E/AndroidRuntime(1689):     at
> java.lang.ClassLoader.loadClass(ClassLoader.java:461) 04-02
> 18:49:31.522: E/AndroidRuntime(1689):     at
> android.app.Instrumentation.newActivity(Instrumentation.java:1023)
> 04-02 18:49:31.522: E/AndroidRuntime(1689):   at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
> 04-02 18:49:31.522: E/AndroidRuntime(1689):   ... 11 more

Upvotes: 0

Views: 1950

Answers (2)

Soshmo
Soshmo

Reputation: 308

I just had the same issue. My problem was that the name of the file and class in the source folder did not match package name in manifest.

I solved this by adding a new class with the correct name.

1: Figure out your package: com.apps.sampleApp Note the name of the end class, in this case sampleApp

2: In source make sure that three is sampleApp.java in src/com.apps.sampleApp

IF YES

make sure the public class is sampleApp

IF NO

There is another file here that extends DroidGap. Copy this to sampleApp.java and change the public class name to sampleApp

Hope that helps others, it solved the issue for me.

Upvotes: 0

Snicolas
Snicolas

Reputation: 38168

You are getting a class not found exception :

 java.lang.ClassNotFoundException: com.src.test1.Test1Activity

It's not bundle in your apk, or obfuscated, or not in your manifest.

Upvotes: 1

Related Questions