java.lang.RuntimeException: Unable to instantiate activity ComponentInfo/ ClassNotFoundException

前端 未结 10 1949
渐次进展
渐次进展 2020-12-15 23:21

I\'m develop android application and than i wanna additional new Activity i had error on my logcat

My LogCat:

04-19 12:59:17.654: D/AndroidRuntime(18         


        
相关标签:
10条回答
  • 2020-12-16 00:25

    This can happen if your activity class is inside a default package. I fixed it by moving the activity class to a new package. and changing the manifest.xml

    before

    activity android:name=".MainActivity"

    after

    activity android:name="new_package.MainActivity"

    0 讨论(0)
  • 2020-12-16 00:25

    I had the same problem, but I had my activity declared in the Manifest file, with the correct name.

    My problem was that I didn't have to imported a third party libraries in a "libs" folder, and I needed reference them in my proyect (Right-click, properties, Java Build Path, Libraries, Add Jar...).

    About how do you declare an activity in the manifest file, is correct use .ActivityName always that activity be in the main package.

    0 讨论(0)
  • 2020-12-16 00:26

    change your activity declaration in the manifest file into

     <activity android:name=".UnlockActivity">
    

    or else

    <activity android:name="Yourcompletepackagename.UnlockActivity">
    

    and try

    0 讨论(0)
  • 2020-12-16 00:26

    change line from

    <activity android:name=".activities.UnlockActivity">  
    

    to

    <activity android:name=".com.bvblogic.android.batterypower.activities.UnlockActivity
     ">
    
    0 讨论(0)
提交回复
热议问题