ฉันเพิ่งเคยใช้ NDK และพยายามตั้งค่าการบูรณาการกับ NDk แต่หลังจากค้นคว้าข้อมูลในหลายๆ ไซต์แล้ว ฉันก็ไม่สามารถแก้ไขปัญหาได้ นี่คือไฟล์ build.gradle
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
}
android.ndk {
moduleName "native"
}
defaultConfig.with {
applicationId "app.com.jnitester"
minSdkVersion.apiLevel 15
targetSdkVersion.apiLevel 23
versionCode 1
versionName "1.0"
buildConfigFields {
create() {
type = "int"
name = "VALUE"
value = "1"
}
}
}
/* android.ndk {
moduleName = "native"
}*/
android.buildTypes {
release {
minifyEnabled false
proguardFiles += file('proguard-rules.txt')
}
}
android.productFlavors {
create("flavor1") {
applicationId "com.app"
}
}
android.sources {
main {
jni {
source {
srcDir 'src'
}
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
my classpath is:
classpath 'com.android.tools.build:gradle-ทดลอง:0.4.0'
เราได้รับข้อผิดพลาดเช่นนั้น:
ข้อผิดพลาด: (18, 0) ไม่มีลายเซ็นของวิธีการ: org.gradle.model.dsl.internal.NonTransformedModelDslBacking.applicationId() ใช้ได้กับประเภทอาร์กิวเมนต์: (java.lang.String) ค่า: [app.com.jnitester] เปิด ไฟล์
เมื่อฉันใส่ buildTypes,productFlavours,sources
ข้างใน android{}
มันทำให้เกิดข้อผิดพลาดเช่นนั้น:
Error:(4, 1) A problem occurred configuring project ':app'.
> Exception thrown while executing model rule: model.android
> Could not find method compileSdkVersion() for arguments [23] on project ':app'.
คำถามนี้อาจซ้ำกันแต่เรายังหาวิธีแก้ปัญหาไม่ได้ ความช่วยเหลือของคุณจะช่วยประหยัดเวลาของฉัน ความช่วยเหลือใด ๆ ที่จะได้รับการชื่นชมในขั้นสูง