我已经更新到MacOS Catalina。今天早上,当我在做Android项目时,它突然开始出现以下异常:“错误:原因:错误= 86,可执行文件中的CPU类型错误”。
我怀疑是因为我更新到了macOS 10.15,又因为我试图为我的项目构建APK(因此它重新构建了renderscript的东西)。这是给出的完整堆栈跟踪:
org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/Users/name/Library/Android/sdk/build-tools/28.0.3/arm-linux-androideabi-ld''
at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:232)
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:209)
at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:356)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86)
at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:38)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: net.rubygrapefruit.platform.NativeException: Could not start '/Users/name/Library/Android/sdk/build-tools/28.0.3/arm-linux-androideabi-ld'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.startProcess(ExecHandleRunner.java:97)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:70)
... 7 more
Caused by: java.io.IOException: Cannot run program "/Users/name/Library/Android/sdk/build-tools/28.0.3/arm-linux-androideabi-ld" (in directory "/Users/name/Documents/Projects/onlinetrucks_android/MyApplication/app"): error=86, Bad CPU type in executable
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 10 more
Caused by: java.io.IOException: error=86, Bad CPU type in executable
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 11 more
在进行Gradle同步时,我得到
warning: Linking two modules of different target triples: /Users/name/Library/Android/sdk/build-tools/28.0.3/renderscript/lib/bc/x86/libclcore.bc' is 'armv7--linux-android' whereas '/Users/name/Documents/Projects/onlinetrucks_android/MyApplication/app/build/generated/res/rs/debug/raw/bc32/singlesource.bc' is 'armv7-none-linux-gnueabi'
和
Execution failed for task ':app:compileDebugRenderscript'.
启动过程'command'/Users/name/Library/Android/sdk/build-tools/28.0.3/arm-linux-androideabi-ld''时出现问题
是否有一种方法可以迫使Android Studio尝试使用库的64位兼容版本?任何帮助将不胜感激,因为该项目的很大一部分取决于Renderscript。
其他说明:
我在此项目中不使用androidX,因为它会弄乱renderscript,然后导致它与Google Play的64位要求不兼容。
我的gradle文件中的renderscript部分看起来像:
renderscriptTargetApi 22
renderscriptSupportModeEnabled true
答案 0 :(得分:2)
对于具有相同问题的任何人,这是一个错误。使用渲染脚本时,链接器使用32位文件。已记录多个错误。如果您想跟踪,可以跟踪此处发生的情况: https://issuetracker.google.com/issues/142590626
抱着大拇指,他们很快就会解决!
答案 1 :(得分:0)
我正在使用Android Studio 4.0,仅通过更新gradle版本即可解决此问题。
在应用的build.gradle中:
- ext.gradle_version = '3.5.3'
+ ext.gradle_version = '4.0.0'
在gradle / wrapper / gradle-wrapper.properties中:
- distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
+ distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip