男儿欲遂平生志,六经勤向窗前读。这篇文章主要讲述RenderScript在Android 6上崩溃相关的知识,希望能为你提供帮助。
我使用RenderScript建立了一个应用程序,在大多数手机上都能正常工作,但在fi.模拟器上用API 21初始化时就崩溃了。我已经最小化了我的renderscript代码,看看什么时候它仍然崩溃。它发生在macOS Catalina和Ubuntu 19.10上。
这可以编译。
#pragma version(1)
#pragma rs java_package_name(com.me.my-obfuscated_package-name);
rs_allocation myFirstAlloc;
但在第二行就崩溃了
private val renderScript = RenderScript.create(context)
private val scriptTest = ScriptC_test(renderScript)
【RenderScript在Android 6上崩溃】在这一行
ScriptC.java
:/**
* Only intended for use by the generated derived classes.
*
* @param rs
*/
protected ScriptC(RenderScript rs, String resName, byte[] bitcode32, byte[] bitcode64) {
super(0, rs);
long id = 0;
if (RenderScript.sPointerSize == 4) {
id = internalStringCreate(rs, resName, bitcode32);
} else {
id = internalStringCreate(rs, resName, bitcode64);
// <
<
<
Exception thrown here
}
if (id == 0) {
throw new RSRuntimeException("Loading of ScriptC script failed.");
}
setID(id);
}
Logcat
--------- beginning of crash
04-18 14:51:25.656 20905-21024/com.myapp.debug A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 21024 (handshare.debug)
04-18 14:51:25.763 12867-12867/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-18 14:51:25.763 12867-12867/? I/DEBUG: Build fingerprint: 'generic_x86_64/sdk_google_phone_x86_64/generic_x86_64:5.0.2/LSY66K/5523115:eng/test-keys'
04-18 14:51:25.763 12867-12867/? I/DEBUG: Revision: '0'
04-18 14:51:25.763 12867-12867/? I/DEBUG: ABI: 'x86_64'
04-18 14:51:25.764 12867-12867/? I/DEBUG: pid: 20905, tid: 21024, name: handshare.debug>
>
>
com.myapp.debug <
<
<
04-18 14:51:25.764 12867-12867/? I/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
04-18 14:51:25.771 12867-12867/? I/DEBUG:rax 0000000000000000rbx 0000000000005220rcx ffffffffffffffffrdx 0000000000000006
04-18 14:51:25.771 12867-12867/? I/DEBUG:rsi 0000000000005220rdi 00000000000051a9
04-18 14:51:25.771 12867-12867/? I/DEBUG:r80000000000000018r900007f7652a76668r10 0000000000000008r11 0000000000000206
04-18 14:51:25.771 12867-12867/? I/DEBUG:r12 0000000000000002r13 0000000000000006r14 0000000000000010r15 00007f763be2a9e0
04-18 14:51:25.771 12867-12867/? I/DEBUG:cs0000000000000033ss000000000000002b
04-18 14:51:25.771 12867-12867/? I/DEBUG:rip 00007f7653944507rbp 00007f76398efb70rsp 00007f76398ee518eflags 0000000000000206
04-18 14:51:25.772 12867-12867/? I/DEBUG: backtrace:
04-18 14:51:25.772 12867-12867/? I/DEBUG:#00 pc 0000000000076507/system/lib64/libc.so (tgkill+7)
04-18 14:51:25.772 12867-12867/? I/DEBUG:#01 pc 000000000002829f/system/lib64/libc.so (pthread_kill+143)
04-18 14:51:25.772 12867-12867/? I/DEBUG:#02 pc 0000000000029571/system/lib64/libc.so (raise+17)
04-18 14:51:25.772 12867-12867/? I/DEBUG:#03 pc 0000000000022e1d/system/lib64/libc.so (abort+61)
04-18 14:51:25.772 12867-12867/? I/DEBUG:#04 pc 0000000000023143/system/lib64/libbcc.so (ELFObject<
64u>
::relocateX86_64(void* (*)(void*, char const*), void*, ELFSectionRelTable<
64u>
*, ELFSectionProgBits<
64u>
*)+1603)
04-18 14:51:25.772 12867-12867/? I/DEBUG:#05 pc 0000000000020d6f/system/lib64/libbcc.so (ELFObject<
64u>
::relocate(void* (*)(void*, char const*), void*)+1071)
04-18 14:51:25.772 12867-12867/? I/DEBUG:#06 pc 0000000000020909/system/lib64/libbcc.so (bcc::ELFObjectLoaderImpl::relocate(bcc::SymbolResolverInterface&
)+25)
04-18 14:51:25.772 12867-12867/? I/DEBUG:#07 pc 0000000000029844/system/lib64/libbcc.so (bcc::ObjectLoader::Load(void*, unsigned long, char const*, bcc::SymbolResolverInterface&
, bool)+164)
04-18 14:51:25.772 12867-12867/? I/DEBUG:#08 pc 0000000000029b54/system/lib64/libbcc.so (bcc::ObjectLoader::Load(bcc::FileBase&
, bcc::SymbolResolverInterface&
, bool)+436)
04-18 14:51:25.772 12867-12867/? I/DEBUG:#09 pc 000000000001791c/system/lib64/libbcc.so (bcc::RSExecutable::Create(bcc::RSInfo&
, bcc::FileBase&
, bcc::SymbolResolverProxy&
)+44)
04-18 14:51:25.773 12867-12867/? I/DEBUG:#10 pc 0000000000015d07/system/lib64/libbcc.so (bcc::RSCompilerDriver::loadScript(char const*, char const*, char const*, unsigned long, char const*, bcc::SymbolResolverProxy&
)+2423)
04-18 14:51:25.773 12867-12867/? I/DEBUG:#11 pc 0000000000012e5c/system/lib64/libRSCpuRef.so (android::renderscript::RsdCpuScriptImpl::init(char const*, char const*, unsigned char const*, unsigned long, unsigned int, char const*)+3132)
04-18 14:51:25.773 12867-12867/? I/DEBUG:#12 pc 0000000000011e34/system/lib64/libRSCpuRef.so (android::renderscript::RsdCpuReferenceImpl::createScript(android::renderscript::ScriptC const*, char const*, char const*, unsigned char const*, unsigned long, unsigned int)+100)
04-18 14:51:25.773 12867-12867/? I/DEBUG:#13 pc 0000000000014800/system/lib64/libRSDriver.so (rsdScriptInit(android::renderscript::Context const*, android::renderscript::ScriptC*, char const*, char const*, unsigned char const*, unsigned long, unsigned int)+32)
04-18 14:51:25.773 12867-12867/? I/DEBUG:#14 pc 000000000003e58c/system/lib64/libRS.so (android::renderscript::ScriptC::runCompiler(android::renderscript::Context*, char const*, char const*, unsigned char const*, unsigned long)+380)
04-18 14:51:25.773 12867-12867/? I/DEBUG:#15 pc 000000000003eb13/system/lib64/libRS.so (android::renderscript::rsi_ScriptCCreate(android::renderscript::Context*, char const*, unsigned long, char const*, unsigned long, char const*, unsigned long)+99)
04-18 14:51:25.773 12867-12867/? I/DEBUG:#16 pc 000000000004615a/system/lib64/libRS.so (android::renderscript::rsp_ScriptCCreate(android::renderscript::Context*, void const*, unsigned long)+42)
04-18 14:51:25.773 12867-12867/? I/DEBUG:#17 pc 0000000000042185/system/lib64/libRS.so (android::renderscript::ThreadIO::playCoreCommands(android::renderscript::Context*, int)+453)
04-18 14:51:25.773 12867-12867/? I/DEBUG:#18 pc 000000000002dd7f/system/lib64/libRS.so (android::renderscript::Context::threadProc(void*)+2207)
04-18 14:51:25.773 12867-12867/? I/DEBUG:#19 pc 000000000002731e/system/lib64/libc.so (__pthread_start(void*)+46)
04-18 14:51:25.773 12867-12867/? I/DEBUG:#20 pc 000000000002339b/system/lib64/libc.so (__start_thread+11)
04-18 14:51:25.773 12867-12867/? I/DEBUG:#21 pc 0000000000019885/system/lib64/libc.so (__bionic_clone+53)
04-18 14:51:25.886 12867-12867/? I/DEBUG: Tombstone written to: /data/tombstones/tombstone_01
应用模块build.gradle
android {
buildToolsVersion versions.buildToolsVersion
compileSdkVersion versions.compileSdkdefaultConfig {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
}
}dependencies {
implementation project(":shared")
implementation project(":presentation")
implementation project(":domain")
implementation project(":data")
}
数据模块 build.gradle
android {
buildToolsVersion versions.buildToolsVersion
compileSdkVersion versions.compileSdkdefaultConfig {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdkrenderscriptTargetApi 21
renderscriptSupportModeEnabled false
}
}
项目级 build.gradle
buildscript {
ext.versions = [
'compileSdk': 29,
'minSdk': 21,
'targetSdk': 29,'buildToolsVersion': '29.0.3'
]
}
我哪里出错了?
答案很明显。
rs_allocation
和任何关系函数都被添加到API 22中。我将设置 renderscriptSupportModeEnabled
为真,未来我会使用动态特性来大幅降低API 22+的大小。推荐阅读
- 从pandas apply()返回多列。
- 如何在OncreateMethod中同时使用AppCompatActivity和Activity类[重复]。
- 我可以在Aws AppSync解析器映射模板中对用户输入进行消毒吗()
- 在安卓系统中,我不能在viewholder中设置图片。
- Android FusedLocationProviderClient.requestLocationUpdates()返回相同的位置坐标。
- 无法获得Android系统中googlemap V2上标记的自定义信息窗口的点击事件。
- 在AppleScript中,在标记后面取X符号并保存到变量中。
- 希望对Android应用中的Kotlin非空断言错误进行解释。
- Android Studio布局问题