我不能使用renderscript。这是我的logcat输出。
10-28 14:23:24.557 5714-5714/com.infasoftlanka.filter E/RenderScript_jni: No GC methods
10-28 14:23:24.557 5714-5714/com.infasoftlanka.filter D/dalvikvm: Trying to load lib /data/data/com.infasoftlanka.filter/lib/librsjni.so 0x42187db0
10-28 14:23:24.562 5714-5714/com.infasoftlanka.filter D/dalvikvm: Added shared lib /data/data/com.infasoftlanka.filter/lib/librsjni.so 0x42187db0
10-28 14:23:24.562 5714-5714/com.infasoftlanka.filter V/RenderScript_jni: RS compat mode
10-28 14:23:24.562 5714-5714/com.infasoftlanka.filter D/dalvikvm: Trying to load lib /data/data/com.infasoftlanka.filter/lib/libRSSupport.so 0x42187db0
10-28 14:23:24.572 5714-5716/com.infasoftlanka.filter D/dalvikvm: GC_CONCURRENT freed 212K, 15% free 9572K/11143K, paused 12ms+2ms, total 32ms
10-28 14:23:24.587 5714-5714/com.infasoftlanka.filter D/dalvikvm: Added shared lib /data/data/com.infasoftlanka.filter/lib/libRSSupport.so 0x42187db0
10-28 14:23:24.587 5714-5714/com.infasoftlanka.filter D/dalvikvm: No JNI_OnLoad found in /data/data/com.infasoftlanka.filter/lib/libRSSupport.so 0x42187db0, skipping init
10-28 14:23:24.587 5714-5714/com.infasoftlanka.filter V/RenderScript_jni: Unable to load libRSSupportIO.so, USAGE_IO not supported
10-28 14:23:24.587 5714-5750/com.infasoftlanka.filter E/RenderScript: Couldn't load libRSSupportIO.so
10-28 14:23:24.587 5714-5750/com.infasoftlanka.filter V/RenderScript: 0x4e88d008 Launching thread(s), CPUs 2
10-28 14:23:24.592 5714-5750/com.infasoftlanka.filter E/RenderScript: Unable to open shared library (/data/data/com.infasoftlanka.filter//lib/librs.color.so): Cannot load library: load_library[1094]: Library 'libRSSupportIO.so' not found
10-28 14:23:24.592 5714-5750/com.infasoftlanka.filter E/RenderScript: Unable to open system shared library (/system/lib/librs.color.so): (null)
10-28 14:23:24.592 5714-5714/com.infasoftlanka.filter D/AndroidRuntime: Shutting down VM
10-28 14:23:24.592 5714-5714/com.infasoftlanka.filter W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x417232a0)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: FATAL EXCEPTION: main
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.infasoftlanka.filter/com.infasoftlanka.filter.MainActivity}: android.support.v8.renderscript.RSRuntimeException: Loading of ScriptC script failed.
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.app.ActivityThread.access$700(ActivityThread.java:140)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:4921)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: Caused by: android.support.v8.renderscript.RSRuntimeException: Loading of ScriptC script failed.
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.support.v8.renderscript.ScriptC.<init>(ScriptC.java:61)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at com.example.rsdemo.ScriptC_color.<init>(ScriptC_color.java:42)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at com.infasoftlanka.filter.MainActivity.onCreate(MainActivity.java:17)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5206)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.app.ActivityThread.access$700(ActivityThread.java:140)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:4921)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
10-28 14:23:24.597 5714-5714/com.infasoftlanka.filter E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
10-28 14:23:28.172 5714-5714/? I/Process: Sending signal. PID: 5714 SIG: 9
Mainactivity.java崩溃:
'ScriptC_color color = new ScriptC_color (mRS, getResources (), R.raw.color);'
我的gradle文件
'
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.infasoftlanka.filter"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
renderscriptDebuggable true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile files('libs/renderscript-v8.jar')
}
'
答案 0 :(得分:0)
您是否尝试过使用Build-Tools 23.0.3?
另外,请尝试替换
ScriptC_color color = new ScriptC_color (mRS, getResources (), R.raw.color);
带
ScriptC_color color = new ScriptC_color (mRS);
答案 1 :(得分:0)
你只需要在proguard-rules.pro中添加这一行 -
-keep class android.support.v8.renderscript。** {*;}
并删除此行 - 编译文件('libs / renderscript-v8.jar')