天天看點

Instant Run導緻的java.lang.ClassNotFoundException錯誤

如果大家使用Android studio來開發Android應用,應該就知道Instant Run 這個東西。但是,這裡有坑。當你在一個新的Android平台上建構并安裝一個新的APP的時候,或者某個應用在該Android平台上已經解除安裝了。如果這時候Instant Run這個功能被勾選的。安裝了該應用之後,點選運作該運用時,就會出現以下錯誤;

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.pax.test/com.pax.test.MainActivity}: java.lang.ClassNotFoundException:
Didn't find class "com.pax.test.MainActivity" on path: DexPathList[[zip file "/data/app/com.pax.test-1/base.apk"],nativeLibraryDirectories=[/data/resource/lib, /vendor/lib, /system/lib]
           

是以解決方法就是,先取消勾選Instant Run這個功能,先在Android平台上安裝好該應用,在之後的建構安裝中再使用Instant Run這個功能。

Instant Run導緻的java.lang.ClassNotFoundException錯誤

繼續閱讀