I've always programmed Android with Eclipse and decided to start migrating to Android Studio. I decided to use the same SDK I already had for Eclipse, then:
- Started a new project
- Set minimum SDK 4.0 (API Level 14)
- Choose Blank Activity option
- Used Default names for Activity Name and Layout Name
- Hit Finish
After a few seconds Gradle finishes the build, and it throws me two errors with the following messages in file Teste4\app\build\intermediates/exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v23\values-v23.xml:
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Under File -> Project Structure -> Modules: app (left column) -> Properties tab, I have the following versions set up:
- "Compile Sdk Version": Android 5.1 (API Level 22)
- "Build Tools Version": 23.0.2
What should I do in order to fix this?
I already tried what was suggested in Stack Overflow question appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable', but it didn't work.
If you are getting errors even after downloading the newest SDK and Android Studio, here is what I did:
I hope it helps someone so that he won't suffer like I did for these couple of days.
If you've tried to change target to a previous GooglePlayServices or AppCompatv7 version and it doesn't work, check if you have any project-libraries dependency, this project will be targeting the latest version of any of these libraries. It happened to me with the Google Maps Utils Library project:
replace:
to
Then you can continue full targeting API 22
If it still doesn't compile, sometimes is useful to set compileSdkVersion API to 23 and targetSdkVersion to 22.
Another solution : navigate to
open
.aar
file with 7-zip or winrar , in res folder removevalues-23
folder and save changes .This issue is raised because now the compile SDK version must match the Android Support library's major version.
In my case i have the
Android Support Library
version 23, so i had to compile against theAndroid SDK version 23
, and I had to change this in mybuild.gradle
file:Well some of you will need to install the SDK,
Android 6.0 (API 23)
and don´t forget to Sync project with gradle files
This is what helped me: Adding specific android platform
What should be done is the following... In my case it was
cordova
but the same is relevant forionic
,phonegap
and other frameworks like these:cordova platform list
. You'll see something like this:remove the android platform:
cordova platform remove android
.then add the specific android platform:
cordova platform add android@5.0.0
.Good luck! :)