Java.lang.ClassNotFoundException after Android studio update

纵饮孤独 提交于 2019-11-27 15:36:12

Try this:

Clear app cache

Clear app data

Uninstall app

Run/Debug again

Hope it works!

Ferran Pons

We are experiencing a similar error after updating to version 2.1 of Android Studio. A class added long ago is now not being found on application start. It's only happening with Android 5.1 and 5.1.1. Really weird crash!

The solution to this was enabling "Instant Run" solves the issue on Lollipop.

caseyh

I experienced this error and had looked at a number of SO threads, and various resources and also checked in to the android dev irc. The answers seem to follow a trend:

Gradle/Android Studio General:

Clean build, reset Android Studio caches, uninstall/reinstall android studio, leave Android Studio and come back to it in 2 hours, restart your computer.

Referencing the class

Is it correctly listed through the manifest? What about gradle configuration?

Loading Classes via IDE (though that seems mostly eclipse related)

Libraries do not get added to APK anymore after upgrade to ADT 22

Android Activity ClassNotFoundException - tried everything

https://www.youtube.com/watch?v=3vqcGhEPHdo

My solution: naming conflict?

I found through pure desperation that by changing my class name Manifest to MyCoolManifest or something like that, I no longer had the issue. Since your class name is Login, perhaps renaming the class will solve your problem.

Try cleaning gradle cache & build by running each line in the terminal:

gradlew --stop
gradlew cleanBuildCache
gradlew clean

Here you go : Clean the project , And uninstall the existing app and run Again .

Saurabh Vardani

You have to provide:

compileSdkVersion '22' buildToolsVersion "22.0.1" 

as your targetSdkVersion 22

For me nothing of the above worked. Until I disabled "Instant Run" to Hot Swap code.

Android studio version: 2.3.3 Latest (at the date of the answer)

Android Test Devices: 5.1.1, 6.0.1

To disable instant run. In Android studio, Got to Preferences -> write "Instant Run" in the search bar -> Uncheck "Enable Instant Run to hot swap code ..."

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!