With upgrade to Android Studio 3.5 now get error: package com.google.android.maps does not exist - android

I have a project using the long since deprecated Maps V1 API, on which I have put in a lot of work and I need it.
I have just upgraded Studio to 3.5 and my current version for which I accepted the recommendations to upgrade the gradle plugin and gradle to versions 3.5.0 and 5.4.1 can't find the maps package on line such as:
import com.google.android.maps.GeoPoint;
Fortunately I have a previous version which barely differs and I didn't accept the upgrade recommendations for the plugin and gradle. The versions are 3.4..2 and 5.1.1. It builds successfully.
The relevant parts of my build.gradle (which is the same for both projects) are:
apply plugin: 'com.android.application'
android {
signingConfigs {
...
}
compileSdkVersion 'Google Inc.:Google APIs:15'
//compileSdkVersion 15
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "uk.co.secret.gridmaps"
minSdkVersion 8
targetSdkVersion 10
}
}
dependencies {
implementation 'org.osmdroid:osmdroid-android:5.2#aar'
// NBT TRY 26 AUGUST 2019
//implementation 'com.google.android.gms:play-services.maps:15.0.0'
}
Uncommenting the last line (as suggested in similar questions) doesn't help either:
ERROR: Failed to resolve: com.google.android.gms:play-services.maps:15.0.0
All suggestions will be gratefully received.
UPDATE 19:00 GMT
I can fix this in a very dirty hard-coded way by adding the line
implementation files ('libs/googleapi21maps.jar')
to the dependencies section of build.gradle. That jar file is just a renamed version of C:\dev\tools\android-sdk-windows5.0\add-ons\addon-google_apis-google-21\lib\maps.jar from my old Windows eclipse project
Given that maps API V1 is dead, it does no harm but it's not elegant at all.
Also given that gradle 5.1.1 can find the package without resorting to this inelegant method, why can't gradle 5.4.1?
Update 2
It builds OK but when I invoke an activity that uses the android.maps, it crashes with an IncompatibleClassChangeError. I changed the version of the libs.jar to 15 with no improvement.
I need to make the latest gradle have backward compatibility with legacy code, even if I have to give an explicit reference to the library that gradle 5.1.1 retrieved.

The compileSdkVersion looks stange, that should be eg. 28 (or 29).
And the current play-services-maps version is 17.0.0:
implementation "com.google.android.gms:play-services-location:17.0.0"
implementation "com.google.android.gms:play-services-maps:17.0.0"
mavenCentral() also has a newer version of osmdroid-android:
// https://mvnrepository.com/artifact/org.osmdroid/osmdroid-android
implementation "org.osmdroid:osmdroid-android:6.1.0"

Related

Xml Suggestions not getting after change compileSdk & targetSdk to 33

I am getting some issue while updating compilesdk and targetsdk to 33.
And if I set compilesdk or targetsdk to 32, 31 or less, I get another library support issue during compilation, as described below...
1. Dependency 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.0-alpha02' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Also, the maximum recommended compile SDK version for Android Gradle
plugin 7.2.1 is 32.
Recommended action: Update this project's version of the Android Gradle
plugin to one that supports 33, then update this project to use
compileSdkVerion of at least 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
and getting this same issue with all newly added library to the gradle
I'm not sure if this is a sdk 33 or library issue.
I already tried this--->https://stackoverflow.com/questions/30684613/android-studio-xml-editor-autocomplete-not-working-with-support-libraries/54007742#54007742
Please Refer this link. There is issue in Android Studio Chipmunk Version. Google Team fixed in Android Studio Dolphin. Check Issue Tracker as well
Replace
def lifecycle_version = "2.6.0-alpha02"
with
def lifecycle_version = "2.4.0-rc01"
in build.gradle(app) file.
Please refer to this link for screenshot.

Android: Error in the V23/Values-V23.xml file [duplicate]

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.
Your compile SDK version must match the support library's major version.
Since you are using version 23 of the support library, you need to compile against version 23 of the Android SDK.
Alternatively you can continue compiling against version 22 of the Android SDK by switching to the latest support library v22.
This happens because after updates Android Studio uses API version 23 by default.
The following worked for me:
Press Ctrl + Shift + Alt + S to get to the project structure page. Go to the properties tab and change 23.0.0 to 22.0.1 (or equivalent to what you were using earlier) in the build tool area and rebuild your project.
If that doesn't work, go to gradle:app and then
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
Edit v7:23.0.0 to v7:22.2.1 as shown above and sync gradle. This will definitely work.
When you update your Android Studio, it uses API version 23 by default,
which is the main reason for its occurrence. So,
At first, check your AppCompat version in build.gradle(Module:app)
That is,
If after changing to 23 there occurs an error then just download
Compile Sdk Version to API 23, and Build Tools Version to 23.0.0
from SDK Manager. If already downloaded then:
1. Go to SDK Manager and
2. Under Project Structure, change *Compile SDK Version* to API 23, and *Build Tools Version* to 23.0.0
Click the SDK Manager Button and open the dialog.
Click SDK Platform and check if Android 6.0 is downloaded or not.
if not, then download that first. After completing the download, click Apply.
Now you need to apply changes to your project from setting.
Then press Ctrl + Alt + Shift + S to open setting
Click the app from the list.
Click properties
Change your Compile SDK Version to API 23
Change your Build Tools Version to 23.0.0
Don't forget to rebuild your project.
Then your error will be gone.
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:
compile 'com.google.android.gms:play-services:+'
to
compile 'com.google.android.gms:play-services:8.3.0'
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.
I agree with the previous answer. Your compile SDK version must match the support library. Here is what I did.
You can go to SDK Manager and under SDK Platform, install the Android 5.X with API level 23.
Under Project Structure, change compile SDK Version to API 23, and Build Tools Version to 23.0.0
Then it should build without problem.
You need to set compileSdkVersion to 23.
Since API 23 Android removed the deprecated Apache Http packages, so if you use them for server requests, you'll need to add useLibrary 'org.apache.http.legacy' to build.gradle as stated in this link:
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
...
//only if you use Apache packages
useLibrary 'org.apache.http.legacy'
}
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 the Android SDK version 23, and I had to change this in my build.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
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId ""
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.1'
}
I found the solution, Problem started when I updated sdk, after that I used different buildToolsVersion ('22.0.1') and I was using different support library like compile 'com.android.support:appcompat-v7:23.0.0', showing you in image below
This was raising problem of "android.widget.Material..."
Then I used same version for support library like compile 'com.android.support:appcompat-v7:22.0.1' and its DONE. (Showing you in below screenshot)
You should compile your project with latest version so update & install from your SDK. Sync your project with sync project with Gradle file Button.
You can also continue with the existing version but check it installed properly below image indicate to API 22 that is properly installed.
And sync your project if needed.
it may help.
As pointed out by Tanis.7x, the support library version (23) does not match the targetSdkVersion (22)
You can fix this by doing the following:
In the build.grade file of your app module, change the following line of code
compile 'com.android.support:appcompat-v7:23.0.0'
To
compile 'com.android.support:appcompat-v7:22.+'
This will use the latest version of the appcompat version that is compatible with SdkVersion 22.
Your compile SDK version must match the support library major version. This is the solution to your problem. You can check it easily in your Gradle Scripts in build.gradle file.
Fx: if your compileSdkVersion is 23 your compile library must start at 23.
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 340
versionName "3.4.0"
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
}
And always check that your Android Studoi has the supported API Level. You can check it in your Android SDK, like this:
In my case it was an higher version of Google-play-services. I set them to 7.0.0 (not 8.x) and all was ok.
I wanted to downgrade from API 23 to 22 and got this error. I had to change all build.gradle files in a project in order to compile.
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.yourapp.app"
minSdkVersion 14
targetSdkVersion 22
}
...
dependencies {
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
}
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 for ionic, phonegap and other frameworks like these:
list all platforms installed for your project: 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! :)
I got the same problems. I solved my problem by updating gradle.build for each sub-module to latest compiler version.
Another solution :
navigate to
\sdk\extras\android\m2repository\com\android\support\appcompat-v7\23.x.x
open .aar file with 7-zip or winrar , in res folder remove values-23 folder and save changes .
on module: app (Gradle)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.namepack.nameappxxxxx"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
project: nameAppXXXX (Gradle)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
and edit your activity of AppCompatActivity to for example Activity:
package com.namepack.nameappxxxxx;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
public class NameClass extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
}
}
Everything is great but none of you explained where to download the SDK build tools
Make sure that all these are in upto date.
Upgrade Android Studio.
I had this issue with Android Studio 1.3.1 and none of the other answers worked for me, but after updating to 1.5.1 there were no problems.
If you are using phonegap(cross-platform) and got same issue above,
just remove the android platform using below command.
phonegap platform remove android
And add it again.
phonegap platform add android
Then problem solved for me.
If you are getting errors even after downloading the newest SDK and Android Studio, here is what I did:
Download the most recent SDK
Open file-Project structure (Ctrl + Alt + Shift + S)
In modules, select app
In the properties tab: Change compile SDK version to API 23 Android 6.0 marshmallow (latest)
I hope it helps someone so that he won't suffer like I did for these couple of days.
As others have already mentioned your compile sdk version must match your support library's major version. This is however, also relevant for subprojects should you have any.
In case you do, you can set your subprojects compile sdk versions with the following script:
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
Add this script in your root build.gradle file.

Android Studio / project appears broken

I had my project working fine in Android Studio but then:
I upgraded to Windows 10
That broke my java install, but I have that
working as well now (removed everything then reinstalled)
I now also updaded to latest stable Android Studio
But when I try build my project now, I get 100+ errors in this:
W:\android-studio-projects\mycustomer\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\22.2.0\res\values-v21\values-v21.xml
Where each error/line is like this:
Error:(2) Error retrieving parent for item: No resource found that
matches the given name 'android:TextAppearance.Material.Inverse'.
...
Someone asked how my app/build.gradle looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:17'
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "dk.company.app"
minSdkVersion 9
targetSdkVersion 17
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
repositories {
maven { url "https://jitpack.io" }
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.github.PhilJay:MPAndroidChart:v2.0.8'
compile 'com.android.support:appcompat-v7:22.2.1'
}
I just inserted the 4rth line in dependencies
compile 'com.android.support:appcompat-v7:22.2.1'
However, it has never been necessary in the past though and inserting it has not fixed my problem. (Why is it suddenly necessary anyhow. Could I maybe remove the dependency - that would fix the issue as well?)
...
Something else that I find peculiar, but probably happens because the project never compiles correct, is that this code:
import dk.company.app.R;
always highlights "R" in red - i.e.cannot resolve symbol 'R'
However, my guess is that it never got as far as generating the file, but stopped when encountering the other appcompat compile errors
...
I can see there are some known similar problems to this:
https://code.google.com/p/android/issues/detail?id=183122
https://medium.com/#Wingnut/installing-android-studio-and-an-ensuing-rabbit-hole-ac3d9a0d3115
However, the solutions proposed. I have removed API 22 and API 23 all places in Sdk manager and file system I could fine. I have changed build tools and appcompa version to 21.1.2
Nothing worked sofar
There's a couple things you can do in attempt to solve this:
Clean project option in Build
Rebuild (not build) project option in Build
Invalidate caches / Restart option in File
Try these, it's a glitch with Android Studio where it doesn't compile everything sometimes.
The com.android.support:appcompat-v7:22.2.1 dependency requires you to compile your project with at least API Version 22 (5.1 Lolipop).
You're currently targeting and compiling using API Version 17 (4.2 Jelly Bean). You can still leave the targetSdkVersion as 17 (if you want) but you must compile with API Version 22+.
Try changing:
compileSdkVersion 'Google Inc.:Google APIs:17'
to:
compileSdkVersion 22
Note: You may also need to download the API Version 22 platform.
Edit: I see you've updated your question that you've attempted to use the v7:21.x.x appcompat library instead. This would require you compile using at least API Level 21 compileSdkVersion 21.
I have gotten this error quite a few times. I compiled a list in this answer of every way I've ever gotten it working again.
EDIT: Just thought of another one that is more likely to be relevant to what you're describing. If you had been compiling against SDK 17, and when you reinstalled Java you upgraded to Java 8, this may cause incompatibilities. I believe only SDKs greater than 20 can compile against Java 8. Also, moving from SDK 17 to 20+ may break your styles, which will cause your xml files to be invalid, which will prevent R from building. Look in res/values/styles and see if it's failing to find your style. If so, change it to a valid style for your new SDK, clean and build.

Error retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23

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.
Your compile SDK version must match the support library's major version.
Since you are using version 23 of the support library, you need to compile against version 23 of the Android SDK.
Alternatively you can continue compiling against version 22 of the Android SDK by switching to the latest support library v22.
This happens because after updates Android Studio uses API version 23 by default.
The following worked for me:
Press Ctrl + Shift + Alt + S to get to the project structure page. Go to the properties tab and change 23.0.0 to 22.0.1 (or equivalent to what you were using earlier) in the build tool area and rebuild your project.
If that doesn't work, go to gradle:app and then
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
Edit v7:23.0.0 to v7:22.2.1 as shown above and sync gradle. This will definitely work.
When you update your Android Studio, it uses API version 23 by default,
which is the main reason for its occurrence. So,
At first, check your AppCompat version in build.gradle(Module:app)
That is,
If after changing to 23 there occurs an error then just download
Compile Sdk Version to API 23, and Build Tools Version to 23.0.0
from SDK Manager. If already downloaded then:
1. Go to SDK Manager and
2. Under Project Structure, change *Compile SDK Version* to API 23, and *Build Tools Version* to 23.0.0
Click the SDK Manager Button and open the dialog.
Click SDK Platform and check if Android 6.0 is downloaded or not.
if not, then download that first. After completing the download, click Apply.
Now you need to apply changes to your project from setting.
Then press Ctrl + Alt + Shift + S to open setting
Click the app from the list.
Click properties
Change your Compile SDK Version to API 23
Change your Build Tools Version to 23.0.0
Don't forget to rebuild your project.
Then your error will be gone.
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:
compile 'com.google.android.gms:play-services:+'
to
compile 'com.google.android.gms:play-services:8.3.0'
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.
I agree with the previous answer. Your compile SDK version must match the support library. Here is what I did.
You can go to SDK Manager and under SDK Platform, install the Android 5.X with API level 23.
Under Project Structure, change compile SDK Version to API 23, and Build Tools Version to 23.0.0
Then it should build without problem.
You need to set compileSdkVersion to 23.
Since API 23 Android removed the deprecated Apache Http packages, so if you use them for server requests, you'll need to add useLibrary 'org.apache.http.legacy' to build.gradle as stated in this link:
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
...
//only if you use Apache packages
useLibrary 'org.apache.http.legacy'
}
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 the Android SDK version 23, and I had to change this in my build.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
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId ""
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.1'
}
I found the solution, Problem started when I updated sdk, after that I used different buildToolsVersion ('22.0.1') and I was using different support library like compile 'com.android.support:appcompat-v7:23.0.0', showing you in image below
This was raising problem of "android.widget.Material..."
Then I used same version for support library like compile 'com.android.support:appcompat-v7:22.0.1' and its DONE. (Showing you in below screenshot)
You should compile your project with latest version so update & install from your SDK. Sync your project with sync project with Gradle file Button.
You can also continue with the existing version but check it installed properly below image indicate to API 22 that is properly installed.
And sync your project if needed.
it may help.
As pointed out by Tanis.7x, the support library version (23) does not match the targetSdkVersion (22)
You can fix this by doing the following:
In the build.grade file of your app module, change the following line of code
compile 'com.android.support:appcompat-v7:23.0.0'
To
compile 'com.android.support:appcompat-v7:22.+'
This will use the latest version of the appcompat version that is compatible with SdkVersion 22.
Your compile SDK version must match the support library major version. This is the solution to your problem. You can check it easily in your Gradle Scripts in build.gradle file.
Fx: if your compileSdkVersion is 23 your compile library must start at 23.
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 340
versionName "3.4.0"
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
}
And always check that your Android Studoi has the supported API Level. You can check it in your Android SDK, like this:
In my case it was an higher version of Google-play-services. I set them to 7.0.0 (not 8.x) and all was ok.
I wanted to downgrade from API 23 to 22 and got this error. I had to change all build.gradle files in a project in order to compile.
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.yourapp.app"
minSdkVersion 14
targetSdkVersion 22
}
...
dependencies {
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
}
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 for ionic, phonegap and other frameworks like these:
list all platforms installed for your project: 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! :)
I got the same problems. I solved my problem by updating gradle.build for each sub-module to latest compiler version.
Another solution :
navigate to
\sdk\extras\android\m2repository\com\android\support\appcompat-v7\23.x.x
open .aar file with 7-zip or winrar , in res folder remove values-23 folder and save changes .
on module: app (Gradle)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.namepack.nameappxxxxx"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
project: nameAppXXXX (Gradle)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
and edit your activity of AppCompatActivity to for example Activity:
package com.namepack.nameappxxxxx;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
public class NameClass extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
}
}
Everything is great but none of you explained where to download the SDK build tools
Make sure that all these are in upto date.
Upgrade Android Studio.
I had this issue with Android Studio 1.3.1 and none of the other answers worked for me, but after updating to 1.5.1 there were no problems.
If you are using phonegap(cross-platform) and got same issue above,
just remove the android platform using below command.
phonegap platform remove android
And add it again.
phonegap platform add android
Then problem solved for me.
If you are getting errors even after downloading the newest SDK and Android Studio, here is what I did:
Download the most recent SDK
Open file-Project structure (Ctrl + Alt + Shift + S)
In modules, select app
In the properties tab: Change compile SDK version to API 23 Android 6.0 marshmallow (latest)
I hope it helps someone so that he won't suffer like I did for these couple of days.
As others have already mentioned your compile sdk version must match your support library's major version. This is however, also relevant for subprojects should you have any.
In case you do, you can set your subprojects compile sdk versions with the following script:
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
Add this script in your root build.gradle file.

Manifest merger failed : uses-sdk:minSdkVersion 10 cannot be smaller than version L declared in library com.android.support:appcompat-v7:21.0.0-rc1

Got the above error after downloading L preview release version in Android Studio, when my project had minSdkVersion 19.
Furthermore, when setting mindSdkVersion as below:
defaultConfig {
....
minSdkVersion 'L'
....
}
I get dozens of errors as below, regarding resources from AppCompat-v7-21 :
/home/user/workspace/project/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0-rc1/res/values-v21/values.xml
Error:Error retrieving parent for item: No resource found that matches the given name '#android:TextAppearance.Material.SearchResult.Subtitle'.
So I have 2 questions:
Why does AS complain about minSdkVersion ? I presume because AppCompat-v7 21 supports only L release; but why ? Also, will it support only L release when it is going to be officially released in autumn too ? Because that would be a problem... Or is it just a temporary restriction in order for apps not be be pushed to Play Store, as specified in the Google I/O 2014 Keynote ?
Why does AppCompat-v7 21 complain about those errors, as I already set mindSdkVersion to L ?
compileSdkVersion 'android-L'
BOOM. Done.
LAST EDIT: As of Android 5.0 release, this is no longer an issue, just target API level 21 directly.
Edit for clarity: Indeed as David_E specified below, this solution only works for L version, if you try to deploy the app on a device below L (ex <=4.4.4) it will complain of OLD_SDK. In order for the app to work pre-L you still need to use the old v20 support lib + app compat + targetVersionSdk and compileVersionSdk
dependencies {
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.android.support:support-v4:20.+'
}
android {
compileSdkVersion 20
buildToolsVersion '20'
defaultConfig {
applicationId "com.example.application"
minSdkVersion 10
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
}
The answer stated here may not work properly, as it will make your app only work for Android L.
In order to conserve the backward compatibility with older Android OS versions, change the gradle dependecy
From:
compile 'com.android.support:appcompat-v7:+'
To:
compile 'com.android.support:appcompat-v7:20.+'
Note that the error complains about com.android.support:appcompat-v7:21.0.0-rc1, the reason for that is that using appcompat-v7:+ will tell gradle to import the latest dependency of the appcompat-v7 library, unfortunately this latest version is only working for Android L, so we have to point to a previous version.
Hopefully Google will fix this in the near future.
The way that worked for me was to install the Android Studio Beta (Not Preview Release, the Beta was launched today as part of IO).
Uninstall the preview release and install the Beta and open your project. It will ask you to use project SDK or Studio SDK, use Android Studio's SDK.
Go to your projects local.properties file and where you have sdk.dir ensure that any backslashes () are doubled up .e.g. \.
Go to Project Structure > SDK and ensure this pointing to the Android SDK on my Pc it was C:\Program Files(x86)\Android\android-studio\SDK.
Then in your projects and any libraries you have build.gradle files where you have
compile 'com.android.support:support-v4
Change it to
compile 'com.android.support:support-v4:20+
Resync the gradle files and all fixed
To force working with a working version
Just change the gradle dependencies like this:
dependencies {
compile 'com.android.support:gridlayout-v7:19.0.1'
compile 'com.android.support:appcompat-v7:19+'
...
}
was:
compile 'com.android.support:appcompat-v7:+'
N.B.
I updated Tools & Extras in the SDK manager.
after the project was broken I fixed it as shown above.
For now I do not update android L & 4.4W (enough bugs for today :-( )
Thanks David for your answer!
I had to change
compile 'com.android.support:support-v13:+'
To:
compile 'com.android.support:support-v13:20.+'
And everything work perfect now.
Just in addition: The other answers here did not fix the problem for me, but I found an alternate way to fix the android-l problem on Android Studio 0.8.0. After I did change the dependencies in the build.gradle, the problem sadly kept occuring, that the code would say OLD_SKD. I'm using a Galaxy S2.
Apart from changing all things to :19+:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19+'
compile 'com.android.support:support-v4:19+'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:mediarouter-v7:19+'
}
It still would not work, so I had to move back everywhere possible:
android {
compileSdkVersion 19
buildToolsVersion '19.1'
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
Now the app works again on the phone.
I should probably get a new mobile, but for now, I hope this may help someone.

Categories

Resources