我们通过以下链接提供了将DroidAR集成到Eclipse项目中的准则:DroidAR Mobile Augmented Reality - How to use the framework in your own application,但是我在AndroidStudio项目中设置DroidAR时遇到了麻烦。

我遵循的步骤是:

  • 从此链接下载了DroidAR-DroidAR
  • 创建了一个新的android studio项目-DroidArSample
  • 导入的droidar文件夹(在下载的归档文件中,位于第2步中)作为DroidArSample中的新模块
  • 将droidar作为对DroidArSample的依赖项
  • 从droidar/AndroidManifest.xml中删除了与图标相关的属性
  • 编译的

  • 它显示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
    
    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.
    

    有任何想法吗?

    最佳答案

    检查build.gradle文件中以下各项之间版本的是否不匹配:

  • compileSdkVersion
  • buildToolsVersion
  • targetSdkVersion
  • 包含的应用程序兼容性库,例如compile 'com.android.support:appcompat-v7:23.0.0'

  • 建议将所有它们都设置为相同版本,以避免出现问题中提到的问题。

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

    (在各个地方声明以下各项)
    compileSdkVersion 23
    
    buildToolsVersion "23.0.0"
    
    targetSdkVersion 23
    
    compile 'com.android.support:appcompat-v7:23.0.0'
    

    Refererence

    关于android - 在Android Studio项目中集成DroidAR时发生Gradle构建错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34636863/

    10-11 00:16