as给vivo手机打包失败的2个问题(1安装失败+2安装后运行失败)

1安装失败

Installation failed with message Invalid File: E:\Work_Temp\Oeasy_May\android\app\build\intermediates\split-apk\debug\slices\slice_5.apk.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

WARNING: Uninstalling will remove the application data!

Do you want to uninstall the existing application?

代码在f盘,生成的包显示在e盘。猜测是缓存的问题。

果断clean,问题解决。可直接打包到手机了

 

2安装后运行失败

09-04 10:04:11.717 25702-25702/com.oecommunity.oeshop E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.oecommunity.oeshop, PID: 25702
    java.lang.RuntimeException: Unable to instantiate application com.oecommunity.oeshop.App: java.lang.ClassNotFoundException: Didn't find class "com.oecommunity.oeshop.App" on path: DexPathList[[zip file "/data/app/com.oecommunity.oeshop-1/base.apk", zip file "/data/app/com.oecommunity.oeshop-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.oecommunity.oeshop-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.oecommunity.oeshop-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.oecommunity.oeshop-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.oecommunity.oeshop-1/split_lib_slice_8_apk.apk"],nativeLibraryDirectories=[/data/app/com.oecommunity.oeshop-1/lib/arm, /vendor/lib, /system/lib]]
        at android.app.LoadedApk.makeApplication(LoadedApk.java:575)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4941)
        at android.app.ActivityThread.access$1600(ActivityThread.java:191)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1586)
        at android.os.Handler.dispatchMessage(Handler.java:111)
        at android.os.Looper.loop(Looper.java:194)
        at android.app.ActivityThread.main(ActivityThread.java:5743)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1077)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:843)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.oecommunity.oeshop.App" on path: DexPathList[[zip file "/data/app/com.oecommunity.oeshop-1/base.apk", zip file "/data/app/com.oecommunity.oeshop-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.oecommunity.oeshop-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.oecommunity.oeshop-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.oecommunity.oeshop-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.oecommunity.oeshop-1/split_lib_slice_8_apk.apk"],nativeLibraryDirectories=[/data/app/com.oecommunity.oeshop-1/lib/arm, /vendor/lib, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
        at android.app.Instrumentation.newApplication(Instrumentation.java:988)
        at android.app.LoadedApk.makeApplication(LoadedApk.java:570)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4941) 
        at android.app.ActivityThread.access$1600(ActivityThread.java:191) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1586) 
        at android.os.Handler.dispatchMessage(Handler.java:111) 
        at android.os.Looper.loop(Looper.java:194) 
        at android.app.ActivityThread.main(ActivityThread.java:5743) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:372) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1077) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:843) 
        Suppressed: java.lang.NoClassDefFoundError: com.oecommunity.oeshop.App
        at dalvik.system.DexFile.defineClassNative(Native Method)
        at dalvik.system.DexFile.defineClass(DexFile.java:226)
        at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
        at dalvik.system.DexPathList.findClass(DexPathList.java:321)
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
                ... 14 more
        Suppressed: java.lang.ClassNotFoundException: com.oecommunity.oeshop.App
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                ... 13 more
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

报分包的时候,找不到某个类。

1.首先看看是不是分包的问题,发现在别的手机可以正常运行,应该不是这个问题

2.Android studio 最新版本是instant run,也会对分包产生影响,试着去关闭

把上图中的取消勾选,再次运行,成功打包,应用成功安装。

 

最后来波总结,如果项目在部分手机上可以成功调试,部分手机不行。可以看看是不是下面几种原因:

1.so 库加载的问题,解决方法是请合理设置 abiFilters; 
2.gradle 版本和 gradle tools 的版本问题 
3.Android Studio clean 和 rebuild 后就能解决。 
4.检查 Android Studio 的 instant run 是否开启,若开启,请关闭。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值