我在x86设备的Razor i上运行android.support.v8.renderscript.*时遇到了致命异常。如果我使用android.renderscript.*,问题就消失了。ARM设备也没有问题。这是异常(exception):

03-03 18:35:26.009  25011-25011/com.example.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.MainActivity}: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]:   143 cannot locate '__strlen_chk'...
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2115)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2153)
            at android.app.ActivityThread.access$700(ActivityThread.java:137)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5031)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]:   143 cannot locate '__strlen_chk'...
            at android.support.v8.renderscript.RenderScript.create(RenderScript.java:945)
            at android.support.v8.renderscript.RenderScript.create(RenderScript.java:982)
            at android.support.v8.renderscript.RenderScript.create(RenderScript.java:968)
            at com.example.app.MainActivity$PlaceholderFragment.createScript(MainActivity.java:92)
            at com.example.app.MainActivity$PlaceholderFragment.onCreateView(MainActivity.java:81)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:829)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035)
            at android.app.BackStackRecord.run(BackStackRecord.java:635)
            at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1397)
            at android.app.Activity.performStart(Activity.java:5067)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2088)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2153)
            at android.app.ActivityThread.access$700(ActivityThread.java:137)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5031)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
            at dalvik.system.NativeStart.main(Native Method)

最佳答案

当我使用构建工具21.1.1和proguard时遇到相同的问题,您可能需要使用以下proguard设置:

-keepclasseswithmembernames class * {
    native <methods>;
}
-keep class android.support.v8.renderscript.** { *; }

有关更多信息:Using the Android Renderscript v8 Support Library

关于android - RenderScript支持库在x86设备上崩溃,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22161832/

10-10 08:22