1
我有實驗(V:0.4.0)的Android模塊使用gradle這個文件與模型塊這樣的:如何導入Android的實驗模塊
apply plugin: 'com.android.mode.application'
model {
android {
compileSdkVersion = 21
buildToolsVersion = "21.1.2"
defaultConfig.with {
applicationId = "com.example.native_libs"
minSdkVersion.apiLevel = 10
targetSdkVersion.apiLevel = 21
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
}
compileOptions.with {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
/*
* native build settings
*/
android.ndk {
moduleName = "native_libs"
stl = "stlport_static"
cppFlags.add("-fexceptions")
cppFlags.add("-fno-rtti")
cppFlags.add("-std=gnu++11")
ldLibs.add("z")
/*
* Other ndk flags configurable here are
* cppFlags.add("-fno-rtti")
* cppFlags.add("-fno-exceptions")
* ldLibs.addAll(["android", "log"])
* stl = "system"
*/
}
android.buildTypes {
debug {
ndk.with {
debuggable = true
}
}
release {
minifyEnabled = false
proguardFiles.add(file('proguard-rules.txt'))
}
}
android.productFlavors {
// for detailed abiFilter descriptions, refer to "Supported ABIs" @
// https://developer.android.com/ndk/guides/abis.html#sa
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")
}
// To include all cpu architectures, leaves abiFilters empty
create("all")
}}
,現在像另一個模塊,我們不能導入的java這個模塊中的包裝類使用實驗性插件。
我改變適用於plugin: 'com.android.mode.application'
但apply plugin: 'com.android.mode.library'
沒有什麼改變,仍然在native_libs模塊:(無法識別的Java包裝類
如何配置爲gradle這個本機模塊庫? 爲什麼實驗插件,不要讓對進口模塊,如其它模塊正常的方式?
[編輯]
我讀這個文檔 http://tools.android.com/tech-docs/new-build-system/gradle-experimental 但是沒有辦法導入結合native(c/C++)和java的模塊。