unable to instantiate application - ClassNotFoundException

后端 未结 13 1595
悲哀的现实
悲哀的现实 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条回答
  •  旧时难觅i
    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.

提交回复
热议问题