Tag Archives: Caused by: java.lang.ClassNotFoundException: Didn’t find class “…”on path: D…

[Solved] Caused by: java.lang.ClassNotFoundException: Didn’t find class “…”on path: D…

Project error:

Caused by: java.lang.ClassNotFoundException: 
 Didn't find class "com.eshore.njb.MyApplication" on path: 
 DexPathList[
 [zip file "/data/app/com.example.administrator.njb-1/base.apk"],
 nativeLibraryDirectories=
 [/data/app/com.example.administrator.njb-1/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64, /product/lib64]]

Reason:

Solution:
there are two build folders in Android project directory, one is project directory/APP/build, the other is project directory/build

Delete both builds and recompile them

Note: when submitting code, two builds should not be submitted

Additional knowledge:
DEX file:

In Android system, DEX file can be directly loaded and run in Dalvik virtual machine. Through ADT, after complex compilation, java source code can be converted to DEX file. What is the format of this file?Why doesn’t Android use the class file directly instead of using this different file?In fact, it is the result of embedded system optimization, Dalvik virtual machine instruction code is not a standard Java virtual machine instruction code, but uses its own unique set of instructions. If you have your own compiler system, you can directly generate the DEX file without generating the class file. Many class names and constant strings are used in dex file, which makes it smaller and more efficient. But in the final analysis, Dalvik is an implementation of register based virtual machine

Build folder:
the location of files generated after code compilation

Error 2:
Alibaba cloud push appears:

08-30 16:43:37.917 13303-13480/com.dch.dai I/zygote64: 

Caused by: java.lang.ClassNotFoundException: 

Didn't find class "com.taobao.orange.OrangeConfigListenerV1" on path: 
DexPathList[[zip file "/data/app/com.dch.dai-7AxXfXOeKbkN7nkIXa89ww==/base.apk"],
nativeLibraryDirectories=[/data/app/com.dch.dai-7AxXfXOeKbkN7nkIXa89ww==/lib/arm64,
/system/fake-libs64, 
/data/app/com.dch.dai-7AxXfXOeKbkN7nkIXa89ww==/base.apk!/lib/arm64-v8a,
/system/lib64, 
/vendor/lib64, 
/product/lib64]]