RenderScript broken on macOS Catalina (10.15)

我怕爱的太早我们不能终老 提交于 2020-06-22 09:52:29

问题


I've updated to MacOS Catalina. This morning while I was working on my Android project, it suddenly started giving the following exception: "ERROR: Cause: error=86, Bad CPU type in executable".

I suspect it it because I updated to macOS 10.15 AND because I tried to build the APK for my project (so it rebuilt the renderscript stuff). Here is the full stack trace given:

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

and on doing a Gradle Sync, I get

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'

and

Execution failed for task ':app:compileDebugRenderscript'.

A problem occurred starting process 'command '/Users/name/Library/Android/sdk/build-tools/28.0.3/arm-linux-androideabi-ld''

Is there a way to force Android studio to try and use the 64-bit compliant versions of the libraries instead? Any help would be appreciated, as a huge part of the project depends on Renderscript.

Additional notes:

  1. I do not use androidX in this project, as it messes up renderscript and then causes it to NOT be compatible for Google Play's 64-bit requirement.

  2. The renderscript part in my gradle file looks like:

    renderscriptTargetApi 22
    renderscriptSupportModeEnabled true
    

回答1:


To anyone having the same issue, this is a bug. When using renderscript, the linker uses the 32 bit file. Multiple bugs have been logged. If you want to keep track, you can follow what is happening over here: https://issuetracker.google.com/issues/142590626

Holding thumbs that they fix it soon!

UPDATE: They have fixed it in the latest buildtools version 29.0.3. You also need to update to Android Studio 3.6 to use it.

BONUS: For anyone else trying to update to AndroidX AS WELL - Renderscript might break on Android6. There is a workaround (as far as I can tell) where you set renderscriptSupportModeEnabled to false - but it doesnt fix it for ALL devices (eg. Xiomi Redmi go - Android 8.1 - then breaks for me).




回答2:


I am using Android studio 4.0, and this issue got fixed for me by just updating the gradle version.

In build.gradle of app:

-    ext.gradle_version = '3.5.3'
+    ext.gradle_version = '4.0.0'

And in 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


来源:https://stackoverflow.com/questions/58373019/renderscript-broken-on-macos-catalina-10-15

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!