像上面一样,我的 build.gradle 文件无法同步,因为它在源集“main”上找不到属性“jni”。我正在使用 gradle-experimental:0.7.0。我不想在编译中使用 Android.mk 文件,但我无法设置 srcDirs = []。我的 build.gradle:
model {
android {
def globalConfiguration = rootProject.extensions.getByName("ext")
compileSdkVersion = globalConfiguration.getAt("androidCompileSdkVersion")
buildToolsVersion = globalConfiguration.getAt("androidBuildToolsVersion")
defaultConfig {
applicationId "com.example.ndk"
minSdkVersion.apiLevel globalConfiguration.getAt("androidMinSdkVersion")
targetSdkVersion.apiLevel globalConfiguration.getAt("androidTargetSdkVersion")
versionCode globalConfiguration.getAt("androidVersionCode")
versionName globalConfiguration.getAt("androidVersionName")
}
buildTypes {
release {
minifyEnabled false
proguardFiles.add(file('proguard-android.txt'))
// signingConfig signingConfigs.release
}
}
sourceSets {
def commonTestDir = 'src/commonTest/java'
test {
java.srcDir commonTestDir
}
androidTest {
java.srcDir commonTestDir
}
main {
jni.srcDirs = []
}
}
}
android.ndk {
moduleName = 'mymodule'
}
}