unable to instantiate application - ClassNotFoundException

后端 未结 13 1504
悲哀的现实
悲哀的现实 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:32

    Have you tried to make a new subclass of MyGameApplicationClass in your 'main' project and set it in the manifest as Application class?

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

    Once I had the same error message, but maybe the cause isn't the same.

    I did a code and worked for a while, then I wanted to improve it and got the same error and I couldn't run it.

    I could fix the problem with

    • the correct Build Path order (as I can see you've already did this)
    • I check on the Order and Export tab the android-suppor-v4.jar
    • and the key was the Android SDK Managert->Upgrade everything and (next) Eclipse->Help->Check for updates.

    After I upgraded to the latest android plugin and SDK my app compiled and ran again.

    I hope this will help you!

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

    This all Process work for me to solve application class Exception.

    Step 1: Open Run(window+R) Search -> Prefetch Remove all file (Some file not Delete)

    Step 2: Open Run(window+R) Search -> %temp% Remove all file (Some File not Delete)

    Step 3: Open Android Studio -> Build -> Clean Project

    OR

    Select File > Invalidate Caches / Restart > Invalidate and Restart from Android Studio toolbar.

    OR

    Close and reopen Android project.

    OR

    Restart System

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

    May be its a Build Path Configuration problem.I did the following to solve the issue.

    1.Right click on your project and go to Java Build Path.

    2.Click on Order and Export tab.

    3.Check Android Private Libraries and other 3rd part libraries if you have added.

    4.Press ok and clean the project. I hope it will solve the issue.

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

    I had a slew of bugs with Android Studio 3.0 Canary 4 and the way I fixed them was by editing the AndroidManifest.xml by adding in some jibberish to the application name. Then, I clicked build. Obviously, a whole mess of new error messages appeared. I changed the name back to what it should be, built the app, and it just ran.

    Sometimes, I just don't know...

    EDIT: Just ran into this issue on Android Studio 3.0 Canary 4 on my laptop when switching over. I again went through the same process of changing AndroidManifest.xml file to contain a typo, building, and changing back. That didn't work.

    I then noticed that instant run was still enabled. Going into settings (by clicking command + , (comma key)) and typing "instant run", I was able to disable instant run, built the app, and the error of class not found went away.

    Summary of Steps to Fix [FOR ME]

    1. Invalidate cache / restart
    2. Clean the project
    3. Manually delete the build folder (need to be in project view for this one)
    4. Make an intentionally errant edit to your AndroidManifest.xml file, build the app, observe the errors, remove the errant edit and build again
    5. Disable instant run

    Again, I don't mean to insinuate that this will fix everyone's error, but I have now used some combination of these steps on two different machines (MacOS Sierra) and it has been resolved for me. Hope it helps.

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

    I ran into this issue several times and both times it seemed to be caused by some instant run feature.

    In my case, deleting the application from the device and then installing it from Android Studio again resolved the issue.

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