Marcel_marcel1991
Marcel_marcel1991

Reputation: 678

Error after adding AppCompat v7 in Android Studio

After adding the appCompat v7 library I get the error that R cannot be resolved, which is apparently due to the fact that R now exists twice. I found an answer to that problem here : Build errors after adding fullscreen activity in Android Studio

However, I dont have or cant find the file attrs.xml in \src\main\res\values\attrs.xml. Is there any other solution to that problem or can someone give me a detailed description of how to do that in Android Studio?

Thank you very much!!!

Upvotes: 1

Views: 8467

Answers (2)

EngineSense
EngineSense

Reputation: 3646

I'm may be noob, but after several search i was able to add appcompat.v7 in android studio.

Initially i was comfortable with Eclipse after Dex Error 65535, my whole hard work was doomed i thought.

As Honey suggested you have to add both support.v4 or v13 and appcompat.v7 in build.gradle.

That's it. This simple solution not even covered in google docs ;). A simple reminder appcompat depends on v4 or v13.

Upvotes: 1

A Honey Bustard
A Honey Bustard

Reputation: 3503

Put this in your /app/build.gradle file :

dependencies {
    compile 'com.android.support:support-v4:18.0.0'
    compile 'com.android.support:appcompat-v7:18.0.0'
}

and make sure the version code (here 18.0.0) is not higher than the buildToolsVersion in the same file :

android {
    compileSdkVersion 16
    buildToolsVersion "18.0.0"
}

then rebuild your project. Hope that helps! Oh and make sure you have the right buildTools installed via SDK Manager! Actual version is 21.0.2 I think.

Upvotes: 2

Related Questions