我正在尝试在我的Android工作室中集成vuforia示例项目。 在我的lib文件夹中添加了vuforia.jar文件。 它给出了两个错误
错误:(21,0)未找到Gradle DSL方法:'compile()' 可能的原因:
的build.gradle(Module.app)
apply plugin: 'com.android.application'
def VUFORIA_SDK_DIR = '../../..'
def NATIVE_LIB_DIR = 'build/lib'
def JAR_DIR = 'build/java/vuforia'
android {
compileSdkVersion 22
buildToolsVersion "25.0.2"
sourceSets.main {
jni.srcDirs = []
jniLibs.srcDir "$VUFORIA_SDK_DIR/$NATIVE_LIB_DIR/"
}
defaultConfig {
applicationId "com.vuforia.samples.VuforiaSamples"
minSdkVersion 9
targetSdkVersion 22
versionCode 600
versionName "6.0"
}
archivesBaseName = rootProject.projectDir.getName()
buildTypes {
release {
minifyEnabled false
ndk {
abiFilters "armeabi-v7a"
}
}
debug {
minifyEnabled false
debuggable true
ndk {
abiFilters "armeabi-v7a"
}
}
}
}
dependencies {
compile files("$VUFORIA_SDK_DIR/$JAR_DIR/Vuforia.jar")
}
的build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
dependencies {
compile fileTree(dir:'libs', include: '*.jar')
compile files('app/libs/Vuforia.jar')
}