Android Renderscript with Gradle

I am building Renderscript processing, and for life I cannot get it to work with gingerbread cookies through Gradle.

Processing uses both Intrinsics and user cores.

with renderscriptTargetApi 18and renderscriptSupportMode truewith the latest build tools buildToolsVersion "19.0.1"and classpath 'com.android.tools.build:gradle:0.8.+'and gradle 1.10 it compiles fine and it works fine on ICS + devices, but it crashes on Gingerbread with the following stack trace:

 Caused by: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Couldn't load RSSupport: findLibrary returned null
        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)

I also tried in various versions:

buildToolsVersion: 18.1.1, 18.1

classpath: 0.7 + 0.7.1

Some of these required gradle 1.9 to run, which I changed and started and worked.

I also tried to include the following lines in build.gradle

dependencies {
    compile files('libs/renderscript-v8.jar')
}

android {

    tasks.withType(com.android.build.gradle.tasks.PackageApplication) {
        pkgTask -> pkgTask.jniFolders = new HashSet<File>();
            pkgTask.jniFolders.add(new File(projectDir, 'libs'));
    }
}

Renderscript Gradle ( , ) - renderscript v8 (multiple dex files define android/support/v8/renderscript/Allocations)

, build.gradle:

apply plugin: 'android'

android {
    compileSdkVersion 18
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 18
        versionCode 1
        versionName "1.0"
        renderscriptTargetApi 18
        renderscriptSupportMode true
    }

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

dependencies {
}

build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.8.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

, :

ICS + Gingerbread?

+3
2

, Gradle - , Gingerbread . :

static {
    System.loadLibrary("RSSupport");
    System.loadLibrary("rsjni");
}

, , , .

+2

Android-Studio RendersScript Build-tools 21.1.0. , build-system changelog 26-32:

  • , .
    • BuildType.runProguard → minifyEnabled
    • BuildType.zipAlign → zipAlignEnabled
    • BuildType.jniDebugBuild → jniDebuggable
    • BuildType.renderscriptDebug → renderscriptDebuggable
    • ProductFlavor.renderscriptSupportMode → renderscriptSupportModeEnabled
    • ProductFlavor.rderscriptNdkMode → renderscriptNdkModeEnabled

, , . build.gradle, :

renderscriptSupportModeEnabled true

, lib.

, - .

+1

All Articles