提问人:sembozdemir 提问时间:7/2/2020 更新时间:7/14/2020 访问量:11618
失败 [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION:无法解析 /data/app/vmdl1686600827.tmp/base.apk:XML 二进制文件损坏]
Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: Failed to parse /data/app/vmdl1686600827.tmp/base.apk: Corrupt XML binary file]
问:
当我升级 Android Studio 4 和 android gradle 插件 4.0.0 时,我遇到了一个奇怪的问题。我的 APK 未部署到任何设备或模拟器。让我解释一下我发现的与问题有关的内容。
1-当我尝试通过单击Android Studio上的“运行”图标来运行应用程序时,构建已成功完成。然后,什么也没发生。
2- 当我尝试使用 .它显示以下错误。adb install
adb: failed to install app/build/outputs/apk/debug/app-x86-debug.apk: Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: Failed to parse /data/app/vmdl1686600827.tmp/base.apk: Corrupt XML binary file]
我还签入了另一个终端会话。我找到了这个关于解析apk的堆栈跟踪。我认为这将有助于找到解决方案。adb logcat
07-01 19:40:16.215 4454 7052 W ResourceType: Bad XML block: header size 28024 or total size 1702240364 is larger than data size 540
07-01 19:40:16.216 4454 7052 W PackageParser: Failed to parse /data/app/vmdl1686600827.tmp/base.apk
07-01 19:40:16.216 4454 7052 W PackageParser: java.io.FileNotFoundException: Corrupt XML binary file
07-01 19:40:16.216 4454 7052 W PackageParser: at android.content.res.ApkAssets.nativeOpenXml(Native Method)
07-01 19:40:16.216 4454 7052 W PackageParser: at android.content.res.ApkAssets.openXml(ApkAssets.java:152)
07-01 19:40:16.216 4454 7052 W PackageParser: at android.content.pm.PackageParser.parseApkLiteInner(PackageParser.java:1594)
07-01 19:40:16.216 4454 7052 W PackageParser: at android.content.pm.PackageParser.parseApkLite(PackageParser.java:1561)
07-01 19:40:16.216 4454 7052 W PackageParser: at com.android.server.pm.PackageInstallerSession.validateInstallLocked(PackageInstallerSession.java:1116)
07-01 19:40:16.216 4454 7052 W PackageParser: at com.android.server.pm.PackageInstallerSession.sealAndValidateLocked(PackageInstallerSession.java:865)
07-01 19:40:16.216 4454 7052 W PackageParser: at com.android.server.pm.PackageInstallerSession.commit(PackageInstallerSession.java:809)
07-01 19:40:16.216 4454 7052 W PackageParser: at android.content.pm.PackageInstaller$Session.commit(PackageInstaller.java:969)
07-01 19:40:16.216 4454 7052 W PackageParser: at com.android.server.pm.PackageManagerShellCommand.doCommitSession(PackageManagerShellCommand.java:2498)
07-01 19:40:16.216 4454 7052 W PackageParser: at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:919)
07-01 19:40:16.216 4454 7052 W PackageParser: at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:158)
07-01 19:40:16.216 4454 7052 W PackageParser: at android.os.ShellCommand.exec(ShellCommand.java:103)
07-01 19:40:16.216 4454 7052 W PackageParser: at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21328)
07-01 19:40:16.216 4454 7052 W PackageParser: at android.os.Binder.shellCommand(Binder.java:634)
07-01 19:40:16.216 4454 7052 W PackageParser: at android.os.Binder.onTransact(Binder.java:532)
07-01 19:40:16.216 4454 7052 W PackageParser: at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2821)
07-01 19:40:16.216 4454 7052 W PackageParser: at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3856)
07-01 19:40:16.216 4454 7052 W PackageParser: at android.os.Binder.execTransact(Binder.java:731)
当我使用APK分析器分析构建的APK时,我看到versionName未知,合并的清单文件已损坏且丢失。
我猜合并清单时出了点问题,但我不明白确切的问题是什么。你有什么想法吗?
答:
1赞
sembozdemir
7/14/2020
#1
我不知何故想通了。我升级了第三方依赖版本,然后问题解决了。特别是,升级从解决了我的问题。我想它与 Gradle 插件 4.0.0 不兼容。我建议你也检查你的第三方依赖项。com.admost.sdk:adcolony:4.1.3.a16
com.admost.sdk:adcolony:4.1.4.a18
为了找出导致问题的依赖项,请通过分析构建的APK来查看合并的清单。
评论
0赞
yennsarah
7/16/2020
很高兴你解决了你的问题!不过,我合并的清单看起来不错,我的下一步将是在 android studio 中逐个文件分析 apks。
评论