开发者

What is this error while building a project in android?

开发者 https://www.devze.com 2023-03-16 16:16 出处:网络
I get this error !!Class Not found.. please check the following error log 开发者_如何学JAVA 06-29 09:09:59.384: ERROR/AndroidRuntime(545): java.lang.RuntimeException: Unable to instantiate activity

I get this error !! Class Not found ..

please check the following error log

开发者_如何学JAVA
06-29 09:09:59.384: ERROR/AndroidRuntime(545): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{s.s/s.s.MainActivity}: java.lang.ClassNotFoundException: s.s.MainActivity in loader dalvik.system.PathClassLoader[/data/app/s.s-2.apk]
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1544)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at android.os.Looper.loop(Looper.java:123)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at android.app.ActivityThread.main(ActivityThread.java:3647)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at java.lang.reflect.Method.invokeNative(Native Method)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at java.lang.reflect.Method.invoke(Method.java:507)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at dalvik.system.NativeStart.main(Native Method)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): Caused by: java.lang.ClassNotFoundException: s.s.MainActivity in loader dalvik.system.PathClassLoader[/data/app/s.s-2.apk]
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1536)
06-29 09:09:59.384: ERROR/AndroidRuntime(545):     ... 11 more


Well, it means that the class is not found :-)

Do you have a class called s.s.MainActivity? Have you misspelled it (disagreement in the spelling between your manifest and source?). Are you accidentally stripping it out of your apk with ProGuard?


Have a look at your Manifestfile... I think not adding the activity there, would cause this problem.

Should look something like this:

        <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
0

精彩评论

暂无评论...
验证码 换一张
取 消