Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchMethodException: com.android.tools.apk.analyzer.BinaryXmlParser.decodeXml 错误 #1314

Closed
aidaole opened this issue Apr 24, 2024 · 5 comments · Fixed by #1353
Closed

Comments

@aidaole
Copy link

aidaole commented Apr 24, 2024

基于最新的代码
image
环境:
android studio 版本: Android Studio Iguana | 2023.2.1
jdk版本: 11 和17 均失败

尝试运行 sample-host./gradlew :sample-host:installDebug 一直失败, 提示错误:

> Task :sample-loader:createDebugApkListingFileRedirect
> Task :sample-loader:assembleDebug

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':sample-base:decodePluginDebugBinaryManifest'.
> java.lang.NoSuchMethodException: com.android.tools.apk.analyzer.BinaryXmlParser.decodeXml(java.lang.String, [B)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':sample-app:decodePluginDebugBinaryManifest'.
> java.lang.NoSuchMethodException: com.android.tools.apk.analyzer.BinaryXmlParser.decodeXml(java.lang.String, [B)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
@shifujun
Copy link
Collaborator

如果是最近build tools更新了,导致找不到这个方法,我们就得重新适配了。你可以看下版本号,我看看能不能复现。

也可以按 https://github.com/Tencent/Shadow/blob/master/CONTRIBUTING.md 中的说明去debug gradle插件。加log也是个选择。

相关逻辑可以搜索commit message找到。

@aidaole
Copy link
Author

aidaole commented Apr 25, 2024

问题已经找到, 是因为我的电脑上配置了Flutter的环境, 将 android sdk home\cmdline-tools\latest 配置到了环境变量中, 导致 com.android.tools.apk.analyzer.BinaryXmlParser 加载错误了. 把环境变量删除之后可以正常编译了

@aidaole aidaole closed this as completed Apr 25, 2024
@gi13371
Copy link

gi13371 commented Jul 10, 2024

问题已经找到, 是因为我的电脑上配置了Flutter的环境, 将 android sdk home\cmdline-tools\latest 配置到了环境变量中, 导致 com.android.tools.apk.analyzer.BinaryXmlParser 加载错误了. 把环境变量删除之后可以正常编译了

你好 我也遇到了这个问题,一直没找到原因,请问有什么思路可以分享吗

@CaoMCan
Copy link

CaoMCan commented Jul 17, 2024

下一个新一点的cmdline-tools,替换原来旧的目录,再来编译就没问题了,我是这样解决的

@aprz512
Copy link
Contributor

aprz512 commented Nov 17, 2024

lastest 的方法签名变了,自己改下 ShadowPlugin 的 createGeneratePluginManifestTasks 就行,里面反射了 decodeXml 方法。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants