1
我正在爲圖像處理領域的android開發應用程序。因此,我需要高性能。部分代碼是用NDK和Renderscript中的其他地方編寫的。 但是,由於沒有生成ScriptC_文件,所以無法編譯應用程序。使用renderscript與gradle實驗
我RS文件夾中... \程序\ SRC \主\ RS
和原始文件夾是在\資源創建
按照gradle這個文件(應用程序):
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
defaultConfig.with {
applicationId = "com.google.sample.helloandroidjni"
minSdkVersion.apiLevel = 18
targetSdkVersion.apiLevel = 23
versionCode = 1
versionName = "1.0"
//habilita o renderscript no projeto
renderscriptTargetApi = 18
renderscriptSupportModeEnabled = true
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file('proguard-android.txt'))
}
}
// ldLibs = ["android", "jnigraphics", <other ndk libraries you might need>] --> Compila as classe necessarias no codigo c
android.ndk {
moduleName = "ibmphotophun"
ldLibs.addAll(["android", "EGL", "GLESv2", "dl", "log", "z", "jnigraphics"]) //adicao de bibliotecas nativas em c do NDK android
debuggable = true
}
android.productFlavors {
create("arm") {
ndk.abiFilters.add("armeabi")
}
create("arm7") {
ndk.abiFilters.add("armeabi-v7a")
}
create("arm8") {
ndk.abiFilters.add("arm64-v8a")
}
create("x86") {
ndk.abiFilters.add("x86")
}
create("x86-64") {
ndk.abiFilters.add("x86_64")
}
create("mips") {
ndk.abiFilters.add("mips")
}
create("mips-64") {
ndk.abiFilters.add("mips64")
}
create("all")
}
}
//repositories {
// maven {
// url 'https://raw.github.com/vRallev/mvn-repo/master/'
// }
//}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile files('libs/droidText.0.4.jar')
compile files('libs/brimage.jar')
}
更好地說明爲什麼這個改變有助於解決這個問題。 – fluter
非常感謝。我做了以下操作併爲我工作,將「rs」文件夾重命名爲「renderscript」,對語句(renderscriptTargetApi = 18)進行了評論,並將minSdkVersion更改爲19。 –