Renderscript:ScriptC脚本加载失败

时间:2018-08-26 23:15:30

标签: android renderscript android-renderscript

当来自Google的发布前报告进入时,有1台设备(华为Mate 9)始终会发生此崩溃:“ ScriptC脚本加载失败”。我从未在任何其他设备上遇到过此问题。

首先,我发生了本机渲染脚本崩溃。

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
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中加载了renderscript):

FATAL EXCEPTION: AsyncTask #1
Process: com.example.renderscripttest, PID: 23315
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.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$1.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$2.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
}

我该如何解决?

1 个答案:

答案 0 :(得分:1)

我收到的崩溃报告是“无法加载ScriptC脚本”。在运行Oreo 8.1的Gigaset GS185上运行

经过长期调查,我们发现仅当移动App到SD卡时,才会发生该错误。也许Google还在外部存储上安装了Apps进行测试?我认为Android在运行时会编译RenderScript,如果脚本在SD卡上,可能会失败。