05
2019
03

安卓打包出现transformNativeLibsWithStripDebugSymbolForRelease异常

打release包时出现transformNativeLibsWithStripDebugSymbolForRelease异常:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformNativeLibsWithStripDebugSymbolForAppRelease'.
    ...
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\Users\qiquanji\AppData\Local\Android\Sdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip''
    at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:198)
    at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:329)
    at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86)
    ... 5 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'C:\Users\qiquanji\AppData\Local\Android\Sdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip'
    at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
    at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22)
    at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
    at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
    ... 5 more
Caused by: java.io.IOException: Cannot run program "C:\Users\qiquanji\AppData\Local\Android\Sdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip" (in directory "E:\Demos\app\android\app"): CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
    ... 8 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
    at java.lang.ProcessImpl.start(ProcessImpl.java:137)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 9 more

上网查教程,许多博客中说的升级gradle版本、修改sdk版本等未能解决问题。

卸载ndk是最后的选择,但不愿意为了一个项目作出这么大的牺牲。仔细看错误日志,发现情况和网上教程不同:网上教程解决的是NullException问题,而我是IoException。于是根据transformNativeLibsWithStripDebugSymbolForReleaseno such file or directory两个关键词再次上网搜索,终于在StackOverflow上找到解决办法:在build.gradle配置中增加不trip项:

packagingOptions{
    doNotStrip '*/mips/*.so'
}

新增配置后再次打包,问题解决。

参考

  1. https://stackoverflow.com/questions/42739916/aarch64-linux-android-strip-file-missing

原文链接:https://www.qiquanji.com/post/4711.html

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

gzh

微信扫码关注

更新实时通知

« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。