这是build.gradle文件
apply plugin: 'com.android.application'
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.3"
defaultConfig.with {
applicationId = "org.artoolkit.ar.samples.ARSimpleNativeCars"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0.2"
buildConfigFields.with {
create() {
type = "int"
name = "VALUE"
value = "1"
}
}
ndk.with {
moduleName = "ARSimpleNativeCars"
}
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
}
}
android.productFlavors {
}
android.sources {
main.jni {
source {
srcDirs = ['src/main/nop']
}
}
main.jniLibs {
source {
srcDirs = ['src/main/libs']
}
}
}
android.compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
//compile 'com.android.support:support-v4:23.0.1'
//compile 'com.android.support:appcompat-v7:23.0.1'
compile project(':aRBaseLib')
} 这是顶级build.gradle文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
repositories {
mavenCentral()
}
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}这是一个ARToolkit示例安卓项目,每当我尝试运行这个项目时,它都会显示
Gradle 'ARSimpleNativeCarsProj' project refresh failed
Error: Cause: buildToolsVersion is not specified.
apply plugin: 'com.android.application' <---- in this line it is actually
apply plugin: 'com.android.model.application' which if I kept it keep saying
failed to find plugin com.android.model.application但是如果我从插件中删除了模型,它会显示buildToolsVersion没有被指定。
提前感谢您的帮助...
发布于 2016-07-25 19:46:21
首先,你需要保留模型。该模型指的是新的实验性gradle插件,它支持Android Studio中的本机代码。有关更多详细信息,请参阅此处:http://tools.android.com/tech-docs/new-build-system/gradle-experimental
如果您删除模型,它将无法找到buildToolsVersion,因为旧的(当前) gradle版本在DSL中没有‘模型’。因此,您需要从gradle.build文件中删除完整的“model{ ... }”部分。但是你需要它,否则你就不能构建这个项目。(所以这只是一个附注)
此外,您的顶级gradle文件实际上应该如下所示
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.7.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}我想知道你为什么会有另一个gradle版本。
此外,请阅读此文档以开始使用原生C/C++代码和NDK:http://artoolkit.org/documentation/doku.php?id=4_Android:android_native进行安卓开发
如果有帮助,请让我知道
https://stackoverflow.com/questions/38553039
复制相似问题