Android java.lang.RuntimeException: Unable to instantiate activity ComponentInfo

前端 未结 12 1645
太阳男子
太阳男子 2021-01-12 03:49

Ok guys this doesn\'t make sense to me at all and I don\'t understand why I am getting this error in my app. I have registered the activity class in the android manifrest xm

相关标签:
12条回答
  • 2021-01-12 04:28

    I got this problem and fix it by moving all .jar files (external library files) which put in "lib" folder to "libs" folder. Somehow, eclipse only know .jar files put in libs folder

    0 讨论(0)
  • 2021-01-12 04:32

    You have put 3rd party library in library folder and reference them. Go to Properties/ Java Build Path/ Libraries/ Add External JARs.

    Check the Jar files in the Properties/ Java Build Path/ Order and Export

    0 讨论(0)
  • 2021-01-12 04:34

    Right click on your Battery class > BuildPath > Exclude Then Right click on your Battery class > BuildPath > Include your class again

    0 讨论(0)
  • 2021-01-12 04:34

    you can just remove the app from your mobile phone or your emulator

    0 讨论(0)
  • 2021-01-12 04:39

    See the crash log carefully:

    loader dalvik.system.PathClassLoader[/mnt/asec/com.mobile.batteryhelper-1/pkg.apk
    

    Here mnt means external SD card.

    Normally, when android:installLocation="auto" is set in AndroidManifest.xml, if the device won't have enough phone memory, then the app will be stored on the SD card. Once you remove the SD card from the device, the app can't find the APK location, then the app crashes.

    Steps to produce the crash:

    Issue able to replicate in HTC sensation 2.3.4 version.

    • Move the app to SD Card by going to Settings-->Manage applications->Click on the app-->Move to SD card
    • Remove the SD card from the device and open the app

    If you try with a Samsung device, it won't crash, but it won't show the app if you remove the SD Card. This behaviour is for a few devices only.

    0 讨论(0)
  • 2021-01-12 04:40

    Actually I found my answer to this same issue here: java.lang.ClassNotFoundException on working app

    You don't provide a name for the Application tag, only the Activity. So if your issue was the same as mine, you should be able to remove the following and things will work:

    android:name=".Battery"

    0 讨论(0)
提交回复
热议问题