我的应用程序在模拟器上工作,但不在我的设备上

时间:2017-02-27 10:35:15

标签: android api emulation

对不起任何语法错误。

我遇到了一个奇怪的问题:我的应用程序在模拟器(Nexus 5X API 25的模拟器)上工作正常,但在我的手机上(Nexus 5X And​​roid 7.1.2 Beta程序)它会崩溃。

奇怪的是,在使用Android 7.1.1的另一部手机上,此应用程序不会崩溃,所以我确定问题与API或类似的东西有关。

一些想法?

应用程序崩溃时的错误:

> 02-26 18:21:13.515 I/Timeline(791): Timeline: Activity_launch_request id:com.application time:718314
02-26 18:21:13.525 I/ActivityManager(549): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.application/.MainActivity bnds=[123,128][240,271]} from pid 791
02-26 18:21:13.616 I/ActivityManager(549): Start proc com.application for activity com.application/.MainActivity: pid=4157 uid=10064 gids={50064, 1028, 1015, 3003}
02-26 18:21:13.716 D/ActivityThread(4157): handleBindApplication:com.application
02-26 18:21:13.786 E/AndroidRuntime(4157): Process: com.application, PID: 4157
02-26 18:21:13.786 E/AndroidRuntime(4157): java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication: java.lang.ClassNotFoundException: Didn't find class "com.android.tools.fd.runtime.BootstrapApplication" on path: DexPathList[[zip file "/data/app/com.application-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.application-1, /vendor/lib, /system/lib]]
02-26 18:21:13.786 E/AndroidRuntime(4157): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.tools.fd.runtime.BootstrapApplication" on path: DexPathList[[zip file "/data/app/com.application-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.application-1, /vendor/lib, /system/lib]]
02-26 18:21:13.796 W/ActivityManager(549):   Force finishing activity com.application/.MainActivity
02-26 18:21:14.496 W/ActivityManager(549): Activity pause timeout for ActivityRecord{420245f8 u0 com.application/.MainActivity t15 f}
02-26 18:21:15.417 I/ActivityManager(549): Process com.application (pid 4157) has died.

如果这有用,我可以发布我的主要代码。

1 个答案:

答案 0 :(得分:0)

Instant Run会尝试热插拔代码;这会导致应用程序类被移动。

禁用即时运行转到文件 - >设置 - >构建,执行,部署 - >即时运行--->取消选中"启用即时运行"