java - 找不到 ARToolkit buildToolsVersion

标签 java android augmented-reality artoolkit

这是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 示例 android 项目 每当我尝试运行这个项目时,它都会说

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。

提前感谢您的帮助...

最佳答案

首先你需要保留模型。该模型是指在 Android Studio 中支持 native 代码的新实验性 gradle 插件。有关更多详细信息,请参见此处: 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 版本。

除此之外,请阅读此文档以开始使用 native C/C++ 代码和 NDK 进行 Android 开发: http://artoolkit.org/documentation/doku.php?id=4_Android:android_native

如果有帮助请告诉我

关于java - 找不到 ARToolkit buildToolsVersion,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38553039/

相关文章:

Java EE 参数约束配置奇怪的行为

java - 将字符串转换为字节数组问题是字符串未转换为字节数组格式

android - Firebase getPhotoUrl 检索低质量图像

java - try catch block 仍然返回应该捕获的异常

java - 当字符串开头与空格匹配时,java ReplaceAll 的令人困惑的结果

java - 字符串 -> java.util.Date -> java.sql.Date(带时间戳)

java - 为什么要使用 Context.MODE_PRIVATE 或 Context.MODE_WRITABLE?

ios - 缩放节点的问题(.simdPivot 与 simdScale 和 .scale 属性)

c++ - VTK的ProjectionTransformMatrix和OpenGL的GL_PROJECTION有什么区别?

ios - OpenCV 的 Iphone 6 相机校准