IEASTX 2017-09-21 14:00 采纳率: 33.3%
浏览 2702
已结题

android studio 导入报错

开始可以运行 然后我拷贝到另外一台电脑上就无法运行
先是报错
Installation failed with message Invalid File: K:\project\app\build\intermediates\split-apk\with_ImageProcessor\debug\slices\slice_0.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?

然后我按照stackoverflow上的方法
Click Build tab ---> Clean Project

Click Build tab ---> Build APK

Run.
走了一遍 但是程序打不开
点击debug 然后
debug界面显示
$ adb install-multiple -r /Users/user/Desktop/x1/Xd/app/build/outputs/apk/app-debug.apk
Split APKs installed
$ adb shell am start -n "com.example.user.xd/com.example.user.xd.FirstActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Connecting to com.example.user.xd
Connected to the target VM, address: 'localhost:8600', transport: 'socket'
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'

Android Monitor 提示
09-21 21:59:40.061 22694-22694/? I/art: Late-enabling -Xcheck:jni
09-21 21:59:40.114 22694-22694/com.example.user.xd W/ActivityThread: Application com.example.user.xd is waiting for the debugger on port 8100...
09-21 21:59:40.114 22694-22694/com.example.user.xd I/System.out: Sending WAIT chunk
09-21 21:59:40.315 22694-22700/com.example.user.xd I/art: Debugger is active
09-21 21:59:40.515 22694-22694/com.example.user.xd I/System.out: Debugger has connected
09-21 21:59:40.515 22694-22694/com.example.user.xd I/System.out: waiting for debugger to settle...
09-21 21:59:40.715 22694-22694/com.example.user.xd I/System.out: waiting for debugger to settle...
09-21 21:59:40.915 22694-22694/com.example.user.xd I/System.out: waiting for debugger to settle...
09-21 21:59:41.115 22694-22694/com.example.user.xd I/System.out: waiting for debugger to settle...
09-21 21:59:41.316 22694-22694/com.example.user.xd I/System.out: waiting for debugger to settle...
09-21 21:59:41.516 22694-22694/com.example.user.xd I/System.out: waiting for debugger to settle...
09-21 21:59:41.716 22694-22694/com.example.user.xd I/System.out: waiting for debugger to settle...
09-21 21:59:41.917 22694-22694/com.example.user.xd I/System.out: debugger has settled (1396)
09-21 21:59:42.009 22694-22694/com.example.user.xd W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=arm --instruction-set-features=smp,div,atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --non-interactive --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=krait --instruction-set-features=default --dex-file=/data/app/com.example.user.xd-2/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@com.example.user.xd-2@split_lib_slice_0_apk.apk@classes.dex) because non-0 exit status
09-21 21:59:42.020 22694-22694/com.example.user.xd W/art: Fallback to original dex file with interpret-mode for /data/app/com.example.user.xd-2/split_lib_slice_0_apk.apk
09-21 21:59:42.021 22694-22694/com.example.user.xd W/System: ClassLoader referenced unknown path: /data/app/com.example.user.xd-2/lib/arm
09-21 21:59:42.025 22694-22694/com.example.user.xd I/InstantRun: starting instant run server: is main process
09-21 21:59:42.031 22694-22694/com.example.user.xd I/art: Rejecting re-init on previously-failed class java.lang.Class
09-21 21:59:42.031 22694-22694/com.example.user.xd D/AndroidRuntime: Shutting down VM
09-21 21:59:42.035 22694-22694/com.example.user.xd E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.user.xd, PID: 22694
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.user.xd/com.example.user.xd.FirstActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.user.xd.FirstActivity" on path: DexPathList[[zip file "/data/app/com.example.user.xd-2/base.apk", zip file "/data/app/com.example.user.xd-2/split_lib_slice_0_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.user.xd-2/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2509)
at android.app.ActivityThread.access$1000(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:5528)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:740)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:630)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.user.xd.FirstActivity" on path: DexPathList[[zip file "/data/app/com.example.user.xd-2/base.apk", zip file "/data/app/com.example.user.xd-2/split_lib_slice_0_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.user.xd-2/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.newActivity(Instrumentation.java:1068)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2350)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2509) 
at android.app.ActivityThread.access$1000(ActivityThread.java:153) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1373) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:5528) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:740) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:630) 
Suppressed: java.lang.NoClassDefFoundError: com.example.user.xd.FirstActivity
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:338)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 13 more
Suppressed: java.lang.ClassNotFoundException: com.example.user.xd.FirstActivity
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)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

  • 写回答

2条回答

  • Heddk 2017-09-22 02:44
    关注

    手动删除bulid目录,检查gradle版本是否一致。检查sdk路径和java路径。如果代码一定没问题,那么肯定是环境问题,多看看环境就应该能找到答案

    评论

报告相同问题?

悬赏问题

  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?