Renderscript:加载 ScriptC 脚本失败
Renderscript: Loading of ScriptC script failed
当 Google 发布预发布报告时,有 1 台设备(Huawei Mate 9)总是出现此崩溃:"Loading of ScriptC script failed"。我从来没有在任何其他设备上遇到过这个问题。
首先,我遇到本机渲染脚本崩溃。
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'HUAWEI/MHA-L29/HWMHA:7.0/HUAWEIMHA-L29/C567B190:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 23408, tid: 23408, name: bcc >>> /system/bin/bcc <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20
x0 0000000000000000 x1 0000007bab3b6dc8 x2 0000007baac00000 x3 0000000000000005
x4 000000000000017c x5 0000007baaf5d6b8 x6 0000007bab72a6be x7 6871736eff736877
x8 0000000000000000 x9 0000007baba0c748 x10 000000000000017c x11 0000000000000000
x12 0000007baba0c788 x13 0000000000000003 x14 000000000000000c x15 2e8ba2e8ba2e8ba3
x16 0000007bad1b3e18 x17 0000007baca5521c x18 0000000000000002 x19 0000007baba97fe8
x20 0000000000000000 x21 0000000000000000 x22 0000007bab3b6dc8 x23 0000007fe3f04078
x24 588d44aeb495b6a2 x25 0000007bab3b6dc8 x26 0000007baad7c890 x27 588d44aeb495b6a2
x28 0000007fe3f037c0 x29 0000007fe3f03670 x30 0000007bac9ff048
sp 0000007fe3f035a0 pc 0000007baca55258 pstate 0000000020000000
backtrace:
#00 pc 0000000000add258 /system/lib64/libLLVM.so (_ZN4llvm22AssumptionCacheTracker18getAssumptionCacheERNS_8FunctionE+60)
#01 pc 0000000000a87044 /system/lib64/libLLVM.so (_ZN4llvm14InlineFunctionENS_8CallSiteERNS_18InlineFunctionInfoEPNS_9AAResultsEb+21468)
#02 pc 0000000000039c4c /vendor/lib64/libbccArm_v2.so (_ZN12rsTranslator29buildTranslatableFunctionListEPN4llvm6ModuleERNS0_9MapVectorIPNS0_8FunctionEN5RsAPI19rootFunctionProps_tENS0_8DenseMapIS5_jNS0_12DenseMapInfoIS5_EENS0_6detail12DenseMapPairIS5_jEEEENSt3__16vectorINSF_4pairIS5_S7_EENSF_9allocatorISI_EEEEEE+2344)
#03 pc 000000000003d0bc /vendor/lib64/libbccArm_v2.so (_ZN12rsTranslator9translateEPN4llvm6ModuleES2_PFPvPKvPKcPmES5_+2448)
#04 pc 000000000003710c /vendor/lib64/libbccArm_v2.so (_Z21translateModuleToMaliPN3bcc8RSScriptEPN4llvm6ModuleES4_+348)
#05 pc 0000000000067854 /system/lib64/libbcc.so (_ZN3bcc8RSScript11LinkRuntimeERS0_PKc+228)
#06 pc 000000000005cf78 /system/lib64/libbcc.so (_ZN3bcc16RSCompilerDriver13compileScriptERNS_8RSScriptEPKcS4_S4_S4_b+152)
#07 pc 000000000005df4c /system/lib64/libbcc.so (_ZN3bcc16RSCompilerDriver17buildForCompatLibERNS_8RSScriptEPKcS4_S4_b+56)
#08 pc 00000000000054a4 /system/bin/bcc
#09 pc 000000000001a68c /system/lib64/libc.so (__libc_init+88)
#10 pc 0000000000003f8c /system/bin/bcc
然后我收到加载失败的正式消息(我在 AsyncTask 中加载渲染脚本):
FATAL EXCEPTION: AsyncTask #1
Process: com.example.renderscripttest, PID: 23315
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask.done(AsyncTask.java:330)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:255)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:776)
Caused by: android.support.v8.renderscript.RSRuntimeException: Loading of ScriptC script failed.
at android.support.v8.renderscript.ScriptC.<init>(ScriptC.java:61)
at com.example.renderscripttest.ScriptC_CalcScript.<init>(ScriptC_CalcScript.java:42)
at com.example.renderscripttest.ScriptC_CalcScript.<init>(ScriptC_CalcScript.java:34)
at com.example.renderscripttest.MainActivity.createScript(MainActivity.java:15660)
at com.example.renderscripttest.InitGPUThread.doInBackground(InitGPUThread.java:12)
at com.example.renderscripttest.InitGPUThread.doInBackground(InitGPUThread.java:5)
at android.os.AsyncTask.call(AsyncTask.java:316)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
... 4 more
这是我的 gradle 设置:
compileSdkVersion 28
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.example.renderscripttest"
minSdkVersion 17
targetSdkVersion 28
versionCode 40
versionName "1.1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
renderscriptTargetApi 17
renderscriptSupportModeEnabled true
}
我该如何解决这个问题?
我在 Gigaset GS185 运行 Oreo 8.1
上收到 "Loading of ScriptC script failed." 的崩溃报告
经过长时间的排查,我们发现只有在将应用程序移动到SD卡时才会出现错误。也许 Google 也会在外部存储上安装应用程序进行测试?我认为 Android 在运行时编译 RenderScript,如果脚本在 SD 卡上,可能会失败。
对我来说,解决方案是
adb root
adb remount
adb shell setenforce 0
您可以通过
查看状态
adb shell getenforce
当 Google 发布预发布报告时,有 1 台设备(Huawei Mate 9)总是出现此崩溃:"Loading of ScriptC script failed"。我从来没有在任何其他设备上遇到过这个问题。
首先,我遇到本机渲染脚本崩溃。
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'HUAWEI/MHA-L29/HWMHA:7.0/HUAWEIMHA-L29/C567B190:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 23408, tid: 23408, name: bcc >>> /system/bin/bcc <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20
x0 0000000000000000 x1 0000007bab3b6dc8 x2 0000007baac00000 x3 0000000000000005
x4 000000000000017c x5 0000007baaf5d6b8 x6 0000007bab72a6be x7 6871736eff736877
x8 0000000000000000 x9 0000007baba0c748 x10 000000000000017c x11 0000000000000000
x12 0000007baba0c788 x13 0000000000000003 x14 000000000000000c x15 2e8ba2e8ba2e8ba3
x16 0000007bad1b3e18 x17 0000007baca5521c x18 0000000000000002 x19 0000007baba97fe8
x20 0000000000000000 x21 0000000000000000 x22 0000007bab3b6dc8 x23 0000007fe3f04078
x24 588d44aeb495b6a2 x25 0000007bab3b6dc8 x26 0000007baad7c890 x27 588d44aeb495b6a2
x28 0000007fe3f037c0 x29 0000007fe3f03670 x30 0000007bac9ff048
sp 0000007fe3f035a0 pc 0000007baca55258 pstate 0000000020000000
backtrace:
#00 pc 0000000000add258 /system/lib64/libLLVM.so (_ZN4llvm22AssumptionCacheTracker18getAssumptionCacheERNS_8FunctionE+60)
#01 pc 0000000000a87044 /system/lib64/libLLVM.so (_ZN4llvm14InlineFunctionENS_8CallSiteERNS_18InlineFunctionInfoEPNS_9AAResultsEb+21468)
#02 pc 0000000000039c4c /vendor/lib64/libbccArm_v2.so (_ZN12rsTranslator29buildTranslatableFunctionListEPN4llvm6ModuleERNS0_9MapVectorIPNS0_8FunctionEN5RsAPI19rootFunctionProps_tENS0_8DenseMapIS5_jNS0_12DenseMapInfoIS5_EENS0_6detail12DenseMapPairIS5_jEEEENSt3__16vectorINSF_4pairIS5_S7_EENSF_9allocatorISI_EEEEEE+2344)
#03 pc 000000000003d0bc /vendor/lib64/libbccArm_v2.so (_ZN12rsTranslator9translateEPN4llvm6ModuleES2_PFPvPKvPKcPmES5_+2448)
#04 pc 000000000003710c /vendor/lib64/libbccArm_v2.so (_Z21translateModuleToMaliPN3bcc8RSScriptEPN4llvm6ModuleES4_+348)
#05 pc 0000000000067854 /system/lib64/libbcc.so (_ZN3bcc8RSScript11LinkRuntimeERS0_PKc+228)
#06 pc 000000000005cf78 /system/lib64/libbcc.so (_ZN3bcc16RSCompilerDriver13compileScriptERNS_8RSScriptEPKcS4_S4_S4_b+152)
#07 pc 000000000005df4c /system/lib64/libbcc.so (_ZN3bcc16RSCompilerDriver17buildForCompatLibERNS_8RSScriptEPKcS4_S4_b+56)
#08 pc 00000000000054a4 /system/bin/bcc
#09 pc 000000000001a68c /system/lib64/libc.so (__libc_init+88)
#10 pc 0000000000003f8c /system/bin/bcc
然后我收到加载失败的正式消息(我在 AsyncTask 中加载渲染脚本):
FATAL EXCEPTION: AsyncTask #1
Process: com.example.renderscripttest, PID: 23315
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask.done(AsyncTask.java:330)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:255)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:776)
Caused by: android.support.v8.renderscript.RSRuntimeException: Loading of ScriptC script failed.
at android.support.v8.renderscript.ScriptC.<init>(ScriptC.java:61)
at com.example.renderscripttest.ScriptC_CalcScript.<init>(ScriptC_CalcScript.java:42)
at com.example.renderscripttest.ScriptC_CalcScript.<init>(ScriptC_CalcScript.java:34)
at com.example.renderscripttest.MainActivity.createScript(MainActivity.java:15660)
at com.example.renderscripttest.InitGPUThread.doInBackground(InitGPUThread.java:12)
at com.example.renderscripttest.InitGPUThread.doInBackground(InitGPUThread.java:5)
at android.os.AsyncTask.call(AsyncTask.java:316)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
... 4 more
这是我的 gradle 设置:
compileSdkVersion 28
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.example.renderscripttest"
minSdkVersion 17
targetSdkVersion 28
versionCode 40
versionName "1.1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
renderscriptTargetApi 17
renderscriptSupportModeEnabled true
}
我该如何解决这个问题?
我在 Gigaset GS185 运行 Oreo 8.1
上收到 "Loading of ScriptC script failed." 的崩溃报告经过长时间的排查,我们发现只有在将应用程序移动到SD卡时才会出现错误。也许 Google 也会在外部存储上安装应用程序进行测试?我认为 Android 在运行时编译 RenderScript,如果脚本在 SD 卡上,可能会失败。
对我来说,解决方案是
adb root
adb remount
adb shell setenforce 0
您可以通过
查看状态adb shell getenforce