unable to instantiate application - ClassNotFoundException

后端 未结 13 1503
悲哀的现实
悲哀的现实 2021-01-01 20:57

EDIT: This problem has not already been resolved in the other suggested SO question

I had a fully working app on the market for over a year, with ve

相关标签:
13条回答
  • 2021-01-01 21:22

    I had this issue in an Android application that needed an Application class which was created in wrong path inside the Android Studio project. When I moved the class file to the correct package, it was fixed.

    0 讨论(0)
  • 2021-01-01 21:24

    For Android Studio:

    Build --> Clean Project

    Fixed issue.

    0 讨论(0)
  • 2021-01-01 21:24

    I'm not very sure about this but it might be that your system's debug.keystore license validity has expired as it is valid for only 365 days. You just need to delete the debug.keystore from your computer. The debug.keystore will be generated automatically by Eclipse when you compile your Android App.

    0 讨论(0)
  • 2021-01-01 21:25

    There are two possibilities. Either you, like me, have a spelling error in your manifest file. Have a co-worker or friend read it to make sure the name is correct. Or you have not referenced the project correctly.

    The official document describes how to properly link projects in its documentation.

    Why it would first seem to work and later stop working is a bit of a mystery. However, I guess that the VM might still have had the necessary references ready to resolve the classes in the library just fine. A restart of the VM removed all those references and trying to resolve them was unsuccessful.

    Update: Regarding the edits in the OP: As you confirm that you have correctly referenced the other project, you can check if the project is included in APK, just to be sure. You can rename and open an APK as any other archive (.rar works fine for me). Sometimes, it happened to me, the project is not correctly included in the APK. A cleaning of your workspace usually remedies the problem and so could a restart of your IDE depending on what you are using. To manually conduct a clean in Eclipse for example, use Project->Clean... or try Android Tools->Fix Project Properties by right-clicking on your project.

    As you seem to also have fixed the problem by restarting your device, it could be that the libraries were linked incorrectly. A problem that I have never seen myself but as a very common quote says: "Have you tried turning it off and on again?".

    0 讨论(0)
  • 2021-01-01 21:26

    I ran into this problem today. The project runs well for over a year but today it reports this issue, and cannot debug on my testing device.

    I fixed it by updating to latest gradle version. Hope this can solve your problem.

    0 讨论(0)
  • 2021-01-01 21:28

    In my case, application id and package were mismatched. This should be same as presented in following images...

    AndroidManifest.xml

    app/build.gradle

    In this case you can see, applicationId and package both are same that is com.mycompany.mygamelibrary

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