更新build.Gradle中的包时,

com.android.support:appcompat-v7
改为
androidx.appcompat:appcompat

发生错误:

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.xxx.xxx/com.xxx.xxx.Activity}: java.lang.ClassNotFoundException: Didn't find class "com.xxx.xxx.Activity" on path: DexPathList[[zip file "/data/app/~~baaKkw-87dI4m8cV_WF1fg==/com.xxx.xxx-KfCiNYkMd3T_0yXDcKpSWA==/base.apk"],nativeLibraryDirectories=[/data/app/~~baaKkw-87dI4m8cV_WF1fg==/com.xxx.xxx-KfCiNYkMd3T_0yXDcKpSWA==/lib/arm64, /data/app/~~baaKkw-87dI4m8cV_WF1fg==/com.xxx.xxx-

可能的原因,和当前App中的其他aar也引用了android.support.v7中类,

比如我的App中,引用的是

import androidx.appcompat.app.AppCompatActivity

本地引用的一个aar文件中,引用的是这个:

import android.support.v7.app.AppCompatActivity;

导致包冲突,需要检查每个包的引用,是否一致。

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐