Android的Renderscript与摇篮 [英] Android Renderscript with Gradle

查看:212
本文介绍了Android的Renderscript与摇篮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个Renderscript处理和我的生活,我不能让它通过摇篮上姜饼工作。

I'm building a Renderscript processing and for the life of me I can't make it work on gingerbread through Gradle.

处理同时使用内部函数和自定义内核。

The processing uses both Intrinsics and custom Kernels.

renderscriptTargetApi 18 renderscriptSupportMode真正与最新版本的工具 buildToolsVersion19.0。 1类路径com.android.tools.build:gradle:0.8 +和1.10的gradle它编译罚款和运行良好的ICS +设备,但它崩溃的姜饼用下面的堆栈跟踪:

using renderscriptTargetApi 18 and renderscriptSupportMode true with 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 runs 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've also tried with a variety of the following versions:

buildToolsVersion :18.1.1,18.1

buildToolsVersion: 18.1.1, 18.1

的classpath :0.7 +,0.7.1

classpath: 0.7.+, 0.7.1

一些人的gradle需要1.9来运行,这是我改变,运行和崩溃。

some of those needed gradle 1.9 to run, which I changed and run and crash.

我也试过,包括下面几行我的的build.gradle

I've also tried including the following lines in my 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'));
    }
}

和添加所有相关的二进制文件按这一问题<一href=\"http://stackoverflow.com/questions/19658145/how-to-use-the-renderscript-support-library-with-gradle\">How使用带有摇篮有时Renderscript支持库(取决于哪个版本我想)汇编,并与同样的错误崩溃,或者因为对renderscript V8封装方法的名称重复申报不编译(多个DEX文件中定义的Andr​​oid /支持/ V8 / renderscript /分配

and add all the relevant binaries as per this question How to use the Renderscript support library with Gradle and sometimes (depending on which versions I'm trying) it compiles and crashes with the same error, or doesn't compile because of duplicate declaration of method names on the renderscript v8 package (multiple dex files define android/support/v8/renderscript/Allocations)

仅作参考这是我的模块的build.gradle:

just for reference that's my module 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:

and that's the top level 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 +和运行姜饼?

What is the correct combination to make it compile successfully and run on both ICS+ and Gingerbread?

推荐答案

我不认为这是一个错误摇篮 - 我认为这是对姜饼及以下一个已知的动态链接问题。尝试添加以下到你的活动:

I don't think this is a Gradle bug--I think this is a known dynamic linking issue on Gingerbread and below. Try adding the following to your Activity:

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

您可能需要重新排序的,我忘了连接问题的确切性质。

you might have to reorder those, I forget the exact nature of the linking issue.

这篇关于Android的Renderscript与摇篮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆