我正在为图像处理领域的 android 开发一个应用程序。因此,我需要高性能。部分代码用 NDK 编写,其他地方用 Renderscript 编写。但是,由于没有生成 ScriptC_ 文件,我无法编译应用程序。
我的 rs 文件在文件夹中...\app\src\main\rs
并且原始文件夹是在\ res中创建的
按照 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')
}