Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle build errors while integrating DroidAR in an android studio project

We have guidelines for integrating DroidAR in an Eclipse project provided at this link: DroidAR Mobile Augmented Reality - How to use the framework in your own application but I am struggling with setting up DroidAR in an AndroidStudio project.

The steps which I followed are:

  1. Downloaded DroidAR from this link - DroidAR
  2. Created a new android studio project - DroidArSample
  3. Imported droidar folder (found within downloaded archive, step 2) as a new module in DroidArSample
  4. Added droidar as a dependency to DroidArSample
  5. Removed icon related attribute from droidar/AndroidManifest.xml
  6. Compiled

It is showing 120 compilation errors, few errors specified below:

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":""}

Final FAILED message is:

 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.

Any ideas?

like image 596
Devarshi Avatar asked Jan 06 '16 15:01

Devarshi


2 Answers

Check your build.gradle file for mismatch of versions between the following:

  1. compileSdkVersion
  2. buildToolsVersion
  3. targetSdkVersion
  4. Included app compat library e.g. compile 'com.android.support:appcompat-v7:23.0.0'

It is recommended to set all of them to the same version to avoid issues like mentioned in your question.

E.g. If you go with API Level-23 your configuration in build.gradle should be as seen below:

(in the respective places each of the following is declared)

compileSdkVersion 23

buildToolsVersion "23.0.0"

targetSdkVersion 23

compile 'com.android.support:appcompat-v7:23.0.0'

Refererence

like image 180
AndroidMechanic - Viral Patel Avatar answered Sep 29 '22 11:09

AndroidMechanic - Viral Patel


i downloaded your project from GitHub and edited the build.gradle in this way:

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.+'
       ...
}

}

Sync, rebuild the project and it works.

like image 25
Bebbolin Avatar answered Sep 29 '22 11:09

Bebbolin