“Unable to instantiate activity” error

后端 未结 6 1048
别跟我提以往
别跟我提以往 2021-02-05 03:39

One of my Android apps has about 100,000 users and, about 10 times a week, I get the following exception being reported to me via Google\'s market tool:

java.lan         


        
6条回答
  •  滥情空心
    2021-02-05 04:05

    Well there are couple of suggestions that might help you debug your application. Hope they solve your issue. Also post your Android Manifest XML file and your MainActivity's onCreate Method snippet so that we could also help you debug it too and narrow down the possibilities ...

    Suggestions:

    1) In your Android XML , check if your minimum Sdk version (android:minSdkVersion="3") is 3 ? If it is change it to 7+ . I have found this trick helpful sometimes while coping up with rare issues.

    2) In your Android XML, check your that you have registered your Activity there. If not please register it, each new activity has to be registered before using it. If your activity is registered, recheck the path that you are supplying to it is also correct.

    3) Clean the project and build it again , so that the R.java is updated and doesn't uses any cached files.

    4) Migrate your project , make one new project and copy all your files there. It also solves rare issues.

    5) According to one user :

    I just got the same error (Unable to instantiate activity...) with Opera Mini. Opera Mini was on SD card (moved to SD card in the app setting). The error seems to be related to the fact that I swapped the SD card yesterday. The device was shutdown, I copied all data from the old card over to the new card (with cp -a) and then inserted the new card and started the device again. Everything seems to work as expected, but I see now that all apps on the SD card crashes with the same error.

    Device: HTC Desire HD (Android 2.2)
    Old SDHC card: SanDisk 8GB class 4
    New SDHC card: Kingston 16GB class 4
    

    So I would say that this is a an Android bug and not something that can be fixed by app developers.

    Also see: http://android-developers.blogspot.com/2010/07/apps-on-sd-card-details.html

    It has always been the case that when you swap SD cards on an Android device, if you physically copy the contents of the old card to the new one, the system will use the data on the new card as if nothing had changed. This is also true of apps which have been installed on the SD card."
    

    This seems to be incorrect.

    Hope one of these solve your problem.

提交回复
热议问题