Search code examples
androidrenderscript

Is it possible to use RenderScript on Android SDK 23+


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'
}

Solution

  • 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