在Android工作室项目中集成DroidAR时Gradle构建错误

时间:2016-01-06 15:32:11

标签: android android-studio augmented-reality

我们有在这个链接提供的Eclipse项目中集成DroidAR的指南:DroidAR Mobile Augmented Reality - How to use the framework in your own application但我正在努力在AndroidStudio项目中设置DroidAR。

我遵循的步骤是:

  1. 从此链接下载DroidAR - DroidAR
  2. 创建了一个新的android工作室项目 - DroidArSample
  3. 导入的droidar文件夹(在已下载的存档中找到,步骤2)作为DroidArSample中的新模块
  4. 添加了droidar作为DroidArSample的依赖
  5. 从droidar / AndroidManifest.xml中删除了与图标相关的属性
  6. 编译
  7. 显示120个编译错误,下面指定的错误很少:

    AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027android:Widget.Material.Spinner.Underlined\u0027.","sources":[{"file":"/Users/devarshi.k/Downloads/DroidArSample/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/res/values-ldltr-v21/values-ldltr-v21.xml","position":{"startLine":1}}],"original":""}
    AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027android:Widget.Material.Spinner.Underlined\u0027.","sources":[{"file":"/Users/devarshi.k/Downloads/DroidArSample/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/res/values-ldrtl-v23/values-ldrtl-v23.xml","position":{"startLine":1}}],"original":""}
    AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027android:textAlignment\u0027.","sources":[{"file":"/Users/devarshi.k/Downloads/DroidArSample/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/res/values-v17/values-v17.xml","position":{"startLine":5,"startColumn":20,"startOffset":407,"endColumn":41,"endOffset":428}}],"original":""}
    

    最终的FAILED消息是:

     FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:processDebugResources'.
    > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/devarshi.k/Library/Android/sdk/build-tools/22.0.1/aapt'' finished with non-zero exit value 1
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    

    有什么想法吗?

3 个答案:

答案 0 :(得分:5)

检查build.gradle文件中以下版本不匹配

  1. compileSdkVersion
  2. buildToolsVersion
  3. targetSdkVersion
  4. 包含的app compat库,例如compile 'com.android.support:appcompat-v7:23.0.0'
  5. 建议将所有版本设置为相同版本以避免问题中提到的问题

    例如如果您使用API​​ Level-23,build.gradle中的配置应如下所示:

    (在相应位置宣布以下各项)

    compileSdkVersion 23
    
    buildToolsVersion "23.0.0"
    
    targetSdkVersion 23
    
    compile 'com.android.support:appcompat-v7:23.0.0'
    

    Refererence

答案 1 :(得分:1)

我从GitHub下载了你的项目并以这种方式编辑了build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    ...

defaultConfig {
        applicationId "daemonconstruction.droidarsample"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
     dependencies {
       ...
       compile 'com.android.support:appcompat-v7:22.+'
       ...
}

}

同步,重建项目并且有效。

答案 2 :(得分:0)

build.gradle

中添加下一行
android {
    ...
    compileOptions.encoding = 'ISO-8859-1' // write your encoding here
    ...
}