android - Android 5.1 错误 [INSTALL_FAILED_DEXOPT]

标签 android maps

在解释为什么我必须发布这个问题之前,让我解释一下,我已经遍历了列表中的大多数其他答案,但都无济于事。

我在安装 APK(通过真实设备上的 adb.exe)期间遇到的问题是 [INSTALL_FAILED_DEXOPT],LogCat 的输出如下:

信息:

PackageManager(  725): init_copy idx=0: InstallParams{1d0ac875 file=/data/local/tmp/PruebaMapas.apk cid=null}
PackageManager(  725): Trying to bind to DefaultContainerService
PackageManager(  725): onServiceConnected
PackageManager(  725): onServiceConnected: true, 0
PackageManager(  725): mcs_bound
PackageManager(  725): startCopy UserHandle{-1}: InstallParams{1d0ac875 file=/data/local/tmp/PruebaMapas.apk cid=null}
PackageManager(  725): Apk copy done
PackageManager(  725): Checking for more work or unbind...
PackageManager(  725): Posting delayed MCS_UNBIND
PackageManager(  725): Start parsing apk: null
PackageManager(  725): Parsing done for apk: null
PackageManager(  725): Start installation for package: null
PackageManager(  725): Linking native library dir for /data/app/com.actividad.PruebaMapas-1
PackageManager(  725): Perform pre-dex opt for package: com.actividad.PruebaMapas
PackageManager(  725): Running dexopt on: /data/app/com.actividad.PruebaMapas-1/base.apk pkg=com.actividad.PruebaMapas isa=arm vmSafeMode=false
PackageManager(  725): Dexopt done on: com.actividad.PruebaMapas
PackageManager(  725): Installation done for package: null
PackageManager(  725): mcs_check
PackageManager(  725): mcs_check(true, 1)
PackageManager(  725): disconnectService: false
PackageManager(  725): mcs_unbind
PackageManager(  725): calling disconnectService()

错误:

PlayCommon( 9265): [745] com.google.android.play.b.h.a(553): Failed to connect to server: java.net.UnknownHostException: Unable to resolve host "play.googleapis.com": No address associated with hostname
AEE/AED (24646): AM write failure (32 / Broken pipe)
AEE/AED (24646): timed out waiting for tid=24637 to stop
AEE/AED (24646): timed out waiting for tid=24638 to stop
AEE/AED (24646): timed out waiting for tid=24639 to stop
AEE/LIBAEE(24646): aee_try_get_word: read:24640 addr:0x00000006 ret:-1, 5
AEE/AED (24646): timed out waiting for tid=24640 to stop
installd(  224): DexInv: --- END '/data/app/com.actividad.PruebaMapas-1/base.apk' --- status=0x0006, process failed

如果我删除对 Google Maps V2 的支持和对 android.support.v4.* 的引用,问题就会消失,但由于我显然需要它,所以只删除它不是一种选择。

我已经减少了依赖项,使生成的 APK(classes.dex,也就是说,因为应用程序编译为 2.3MB)小于 5MB。

我已经实现了多重 dexing,使每个 .dex 小于 5MB。

该应用程序在运行 Android 4.4 的旧设备上安装并运行良好。以及运行各种操作系统版本的许多其他设备。

这让我想到,由于我正在 Finow X5 Air Smartwatch 上测试它,我不确定它是否真的是 5.1,它可能更旧并声明它是 5.1?我不知道,这是一 block 中国 watch ,所以所有的赌注都没有了。 (更新:Smartwatch OS 不是罪魁祸首,它是真正的 5.1 OS,虽然 watch 的质量很糟糕。)

我没有使用 Gradle 或 Android Studio。我正在使用自己正在开发的编译器,因此,我正在使用命令行编译应用程序。但源代码是用 Java 编写的,与 Android Studio 中使用的代码没有任何不同。

为了获得帮助,我需要声明的任何其他内容,我会的。谢谢。

编辑: 我添加了更多 logcat 信息。

最佳答案

我在使用 Android Gradle Plugin 3.1.2 时遇到了同样的问题。

更新版本到3.1.3后,问题消失:

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'
}

我猜这是D8的问题:

New DEX compiler, D8

By default, Android Studio now uses a new DEX compiler called D8. DEX compilation is the process of transforming .class bytecode into .dex bytecode for the Android Runtime (or Dalvik, for older versions of Android). Compared to the previous compiler, called DX, D8 compiles faster and outputs smaller DEX files, all while having the same or better app runtime performance.

D8 shouldn't change your day-to-day app development workflow. However, if you experience any issues related to the new compiler, please report a bug. You can temporarily disable D8 and use DX by including the following in your project's gradle.properties file:

android.enableD8=false

See: https://developer.android.com/studio/releases/gradle-plugin#D8


此外,我尝试了 Android Gradle Plugin 3.1.2 + android.enableD8=false,它也可以工作...

关于android - Android 5.1 错误 [INSTALL_FAILED_DEXOPT],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50457886/

相关文章:

android - Unity3D构建错误

php - 使用Retrofit、PHP、JSON和WAMP从Android应用程序获取Mysql数据库的信息

android - 使用 Android BillingClient 2.1 检索应用内购买,返回空列表

java - 当我单击按钮时重新启动应用程序

neo4j - 如何在密码中获取 map 的值

iphone - 如何在 iPhone 应用程序内的 MKMapView 中显示和连接带有注释的路线的多个位置?

Android 浏览器和背面可见性问题

postgresql - ST_MakeEnvelope 与谷歌地图坐标问题

maps - 如何打开谷歌地图正在使用的infoWindow?

java - 未安装 map 时应用程序将关闭