0
votes

I've been struggling with getting RenderScript to work on my app with a TargetSDKVersion 26 and a minSDKVersion 21 getting an error at Gradle Sync:

Error:Execution failed for task ':app:compileDebugRenderscript'. com.android.ide.common.process.ProcessException: Error while executing process /home/mail929/.android/sdk/build-tools/26.0.2/llvm-rs-cc with arguments {-O 3 -I /home/mail929/.android/sdk/build-tools/26.0.2/renderscript/include/ -I /home/mail929/.android/sdk/build-tools/26.0.2/renderscript/clang-include/ -p /home/mail929/Code/Android/SmartME/app/build/generated/source/rs/debug -o /home/mail929/Code/Android/SmartME/app/build/generated/res/rs/debug/raw -target-api 21 /home/mail929/Code/Android/SmartME/app/src/main/rs/combine.rs}

Eventually I noticed at the bottom of the documentation page:

Graphics Functions and Types

The graphics subsystem of RenderScript was removed at API level 23.

Does this mean I can't use RenderScript at all? If so are there any good alternatives?

Here is my complete build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "edu.marquette.mcw.smartme"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 4
        versionName "2rc1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        renderscriptTargetApi 18
        renderscriptSupportModeEnabled false

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.0.0'
    compile 'com.android.support:cardview-v7:26.0.0'

    testCompile 'junit:junit:4.12'
}
2

2 Answers

1
votes

No, Renderscript hasn't been completely deprecated, only the graphics functionality which operated on some OpenGL type constructs directly. Since it was more or less doing the same thing available in OpenGL, it was dropped and instead you can exchange textures with OpenGL.

The combination of minSdkVersion and renderscriptTargetApi in your build.gradle will result in the minSdkVersion being used for the Renderscript target API. The way this works can get really odd. Unless you absolutely need something in the android.renderscript framework package, use the support library version by setting renderscriptSupportModeEnabled to true. This may also help resolve whatever issue you are seeing. If it doesn't, try to provide more details from the build log.

0
votes

Well I actually decided to manually run the command to see what was wrong and recevied the following error:

error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

I fixed this by installing ncurses-compat-libs on Fedora and Gradle Sync completes successfully