Upgrade Android studio to 3.0 and prompt the solution of java.lang.noclassdeffounderror

resolvent

First, write out the method, the cause, process and principle in the back, and look at the solution in a hurry.

Generally, this error is caused by using provided

For example, my old configuration is as follows:

Project build.gradle file:

Change to the latest build. Gradle3. X configuration:

Project build.gradle file:

After changing the above configuration, you can run successfully after building project. If not, please look down:

matters needing attention:

The configuration of the above module build.grade must be written in the module where the annotation is used!

For example, if I use the annotation of @ fybersdk for mainactivity in module a, I will write the above configuration in the build.grade file of module a.

Supplement relevant knowledge

Introduction to apt

1. What is apt?

Apt (annotation processing tool) is a tool for processing annotations. It detects the source code files, finds out the annotations, and automatically generates code according to the annotations. When the annotation processor comes out for annotation, it can generate additional source files and other files according to the annotation in the source file (the specific content of the file is determined by the author of the annotation processor). Apt will also compile the generated source file and the original source file to generate a class file together.

2、annotationProcessor

Annotation processor is one of apt tools. It is a built-in framework developed by Google. It does not need to be introduced and can be directly used in the build.gradle file

3、android-apt

Android apt is an apt framework developed by a developer. The source code is hosted here. With the release of Android gradle plug-in version 2.2, Android gradle plug-in provides a function called annotationprocessor to completely replace Android apt. since then, the author of Android apt has made a statement on the official website that the latest Android gradle plug-in now supports annotationprocessor, And warn and or block Android apt, and recommend that you use the official Android plug-in annotation processor.

other

summary

The above is the Android studio upgrade to 3.0 prompt java.lang.noclassdeffounderror introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>