I decided to reduce my api level from 23 to 22. To begin with, I downloaded android studio with the latest 23 API installed. I installed the 22 API now but I don't know if I installed the other stuff like:
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
Can't find where to look if these are installed... So this is how my manifest looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22 //changed this, used to be 23
buildToolsVersion "22.0.0" //changed this also, but I don't know if it's installed....
defaultConfig {
applicationId "xxx"
minSdkVersion 16
targetSdkVersion 22
versionCode 11
versionName "2.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { java.srcDirs = ['src/main/java', 'libs'] } }
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.twitter.sdk.android:tweet-composer:1.0.2#aar') {
transitive = true;
}
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:22.2.0'//changed this also, but I don't know if it's installed....
compile 'com.android.support:design:22.2.0'//changed this also, but I don't know if it's installed....
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.google.android.gms:play-services-identity:8.4.0'
}
So when I try to sync it gives me this crap:
C:\Users\jonathan\AndroidStudioProjects\TrashOmeter\app\build\intermediates\res\merged\debug\values-v23\values-v23.xml
Error:(18) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\jonathan\AppData\Local\Android\sdk\build-tools\22.0.0\aapt.exe'' finished with non-zero exit value 1
How do I get it to compile with 22 sdk correctly???
You wont be able to downgrade from SDK 23 to 22 if have already uploaded your apk (sdk 23) on google play. Store will not let you.
I have already done this mistake and now my APP is disadvantaged compared to my competitors who didnt made this mistake.
So DONT USE SDK 23, it will make your users angry if they have to enable LOCATION for your app (access to wifi channel list is main purpose of my app)
I decided to reduce my api level from 23 to 22
Given the comments in your build.gradle file, you appear to mean that you reduced your compileSdkVersion to 22.
I have no idea why you would do that.
Raising the compileSdkVersion to a newer level is perfectly reasonable and will be required to use some newer versions of dependencies (let alone any new references from your own code). I know of no problems in modern Android development that are solved by reducing compileSdkVersion. You seem to be causing yourself pain for no actual benefit.
I installed the 22 API now but I don't know if I installed the other stuff like
If you have an up-to-date "Android Repository" in the SDK Manager, then you have older versions of the Android Support libraries.
//changed this also, but I don't know if it's installed...
If you have an up-to-date "Build Tools" in the SDK Manager, then you have older versions of the Android Support libraries.
So when I try to sync it gives me this crap:
That "crap" is because you decided to change your compileSdkVersion to 22, yet not change your dependencies to similarly older versions. Your current dependency versions are written with references to things from API Level 23 (in this case, resources) and need compileSdkVersion 23.
How do I get it to compile with 22 sdk correctly?
Reduce the versions of your dependencies to ones that pre-date the existence of API Level 23. For those that you are getting from Maven Central or JCenter (e.g., facebook-android-sdk), you can probably find out dates of artifacts from their Web interface, and try to find ones from August 2015 or earlier. For the rest... you're on your own.
Or, change your compileSdkVersion back to 23.
So thanks to CommonsWare I found the answer. I had to change the google play dependency to a lower version. So in gradle I changed:
From:
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
To:
compile 'com.google.android.gms:play-services:7.3.0'
compile 'com.google.android.gms:play-services-identity:7.3.0'
Related
I have installed Android Studio 3.1.13 with gradle 4.8.1 and java 1.8.0_171, previously installed. I have installed also the SDK API 22 because I need to test an app in Android 5.1.1
The problem is that the default configuration has compileSdkVersion 28 and I had changed it to 22. I have tried many settings but there are always errors due to the version of android API
My current module build.gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.company.test"
minSdkVersion 22
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.0.0'
}
and the proyect build.gradle is
buildscript {
repositories {
google()
jcenter()
}
dependencies {
//classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
When I tried to build, the IDE now says
The SDK Build Tools revision (22.0.1) is too low for project ':app'. Minimum required is 25.0.0
Don't know how can I build and test and app for API 22. I'm newbie in Android develpoment. Thanks in advance
As far as I understand your question, the app needs to be tested running on android api level 22 right?
Based on this assumption I would say the most straight forward solution would be to keep every value on default (as long as this worked for you before). Just lower the minSdkVersion to 22.
Short explanation of most important values:
compileSdkVersion 22 : API Level the app is compiled against
buildToolsVersion '22.0.1' : Buildtools Version to compile code (has to match compileSdkVersion)
minSdkVersion 22 : This is the minimum api you want the app running on.
targetSdkVersion 22 : Simply says, you tested your app running on specified API. Google now uses this to determine if your app is up to date to be published in Playstore or not
As emandt already mentioned BUILDTOOLS and gradle should be up to date, as well as targetSdkVersion and compileVersion.
TESTING APP ON API Level:
As long as you compiled your app for a target higher than minSdk you can simply build and install the apk to a device running the requested API level.
The "buildToolsVersion" string should be compatible with the "classpath 'com.android.tools.build:gradle:x:x:x" setting.
You have to lower the second setting until it is accepted.
However I suggest to use latest BUILD TOOLS and latest GRADLE and not revert back to an old ones. Those Tools affect only the Build procedure, not the App itself.
I'm currently developing an app in Android Studio and have been for several weeks now. I am wanting SDK 21, not 23! SDK 21 has been working for the past few weeks with no problems at all
This morning, I have retuned to my PC to carry on with my programming, went to run the application and these errors appeared:
Error:(3) Error retrieving parent for item: No resource found that
matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(18) Error retrieving parent for item: No resource found that matches the
given name 'android:Widget.Material.Button.Colored'.
Between the app working last night and trying to run the app this morning - nothing has changed. I haven't even closed down android studio. I left my PC on sleep.
I have searched stack overflow and noticed that these errors have occurred for others too. I have tried the answers that have been given to others such as checking the project structure, dependencies, gradle file etc. I have also tried the standard clean and build
This is my Gradle file:
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.example.package"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:21.1.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:support-v4:21.0.3'
}
Apologies for the images being links, I'm new to SO so can't embed them to a post yet.
It's completely possible that I am missing something obvious but I have been trying to solve this problem for the past few hours and I'm not getting anywhere.
Any help would be greatly appreciated!
Stand Alone SDK Manager Screen Shot
Dependencies
When you added
compile 'com.google.android.gms:play-services:8.4.0'
This dependency requires the 23.0.0 version of the support-v4 library (FWIW, 8.3 and 8.1 require 22.2.0, hence you are compiling with the API 23 versions of the Support Library.
Keep in mind though, the best practice, as described in the Picking your compileSdkVersion, targetSdkVersion, and minSdkVersion is to always compile with the latest SDK:
It should be emphasized that changing your compileSdkVersion does not change runtime behavior. While new compiler warnings/errors may be present when changing your compileSdkVersion, your compileSdkVersion is not included in your APK: it is purely used at compile time. (You should really fix those warnings though — they were added for a reason!)
Therefore it is strongly recommended that you always compile with the latest SDK. You’ll get all the benefits of new compilation checks on existing code, avoid newly deprecated APIs, and be ready to use new APIs.
Therefore the easiest solution is to change your compileSdkVersion to API 23, while leaving your targetSdkVersion (what controls runtime behavior and use of things like runtime permissions) at whatever level you currently have.
try changing
compile 'com.android.support:support-v4:21.0.3'
to
compile 'com.android.support:support-v4:21.1.0'
I am facing a strange issue, i installed latest appcompat-v7:23.0.0
Where as i got to know i must not need it but i need to go with appcompat-v7:22.2.1 or appcompat-v7:22.0.0
I updated my gradle as per my needs but it always pickup appcompat-v7:23.0.0 which is not required, any one guide me how can i resolve this issue?
Since you are using
compile 'com.google.android.gms:play-services:+'
you are using the latest version compile 'com.google.android.gms:play-services:8.4.0' which has a dependency with support libraries v23.
You have to compile with API 23.
Change this line:
compileSdkVersion 23
If you don't want to use the api23 you can use a specific version like as
compile 'com.google.android.gms:play-services:7.8.0'
In general is not a good practice the use of + in your dependencies because you can't replicate the build in the future with the same libraries and you don't know which version you are using.
Also you can use api23 with Httpclient.
Just use:
android {
useLibrary 'org.apache.http.legacy'
}
More info here.
The useLibrary requires the gradle plugin 1.3.0 (classpath 'com.android.tools.build:gradle:1.3.0') or higher.
AppCompat (aka ActionBarCompat) started out as a backport of the
Android 4.0 ActionBar API for devices running on Gingerbread,
providing a common API layer on top of the backported implementation
and the framework implementation. AppCompat v21 delivers an API and
feature-set that is up-to-date with Android 5.0
You can use
compile 'com.android.support:appcompat-v7:22.0.1'
Finally
android {
compileSdkVersion 22
buildToolsVersion '22.0.1' // You can set buildToolsVersion '23.0.1'
Advice
You should use
compile 'com.google.android.gms:play-services:7.8.0' // or 8.4.0
Good Approach : Use latest Version .
you need to download the latest support repository from internal SDK
manager of Android Studio or from the stand alone SDK manager. Then
you can add compile 'com.android.support:appcompat-v7:23.0.1'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId ""
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
dependencies {
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0' // or 8.4.0
}
Edit
You can use this classpath
classpath 'com.android.tools.build:gradle:1.3.0'
Then Clean-Rebuild-Restart-Sync your project . Hope this helps .
I'll start from what I want to achieve: building the googlecast-manager example provided here: https://github.com/googlecast/GameManagerSamples
I followed instructions here: https://developers.google.com/cast/docs/android_sender
So first I downloaded from github the project, then with the Android SDK Manager I downloaded Android Support Libraries and Google play Services. Then in my project, I went to "Open Modules Setting->Add" then went to "Android SDK\extras\android\support\v7\appcompat" and added it.
Then first step to ensure it's working is to build it. So I right clicked on appcompat->"Compile Module Appcompat" but it fails with 2 errors:
Error:(20, -1) android-apt-compiler: [appcompat] D:\Android
SDK\extras\android\support\v7\appcompat\res\values-v23\styles_base.xml:20:
error: Error retrieving parent for item: No resource found that
matches the given name 'android:Widget.Material.Button.Colored'.
Error:(19, -1) android-apt-compiler: [appcompat] D:\Android
SDK\extras\android\support\v7\appcompat\res\values-v23\styles_base_text.xml:19:
error: Error retrieving parent for item: No resource found that
matches the given name
'android:TextAppearance.Material.Widget.Button.Inverse'.
Doing the same for Google Play works like a charm.
I've tried to find videos/other similar issues but it's either too complicated or not my problem.
Here is the AndroidManifest.xml of appcompat:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v7.appcompat">
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="19"/>
<application />
Here is what is installed from the Android SDK Manager:
I also encountered the same problem and now have fixed it. What you just have to do is
Inside your Android Studio
press Shift button two times, a search box will appear type build.gradle
choose build.gradle module:app from the suggestion.
major version of compileSdkVersion and support libraries under dependencies should be same as following code depict.
Inside Eclipse
find build.gradle module:app and do the same.
Note: download and install properly the latest API which is now API 23.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.inzi.app"
minSdkVersion 9
targetSdkVersion 23
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:23.0.0'
}
I believe you should upgrade your compileSdkVersion. Check your build.grade file, should be something like:
android {
compileSdkVersion 23 // <- here
buildToolsVersion "23.0.0" // <- here
defaultConfig {
applicationId "your.id"
minSdkVersion 11
targetSdkVersion 23 // <- and maybe here
versionCode 1
versionName "1.0"
}
buildTypes {
....
}
}
Of course you will need to download the newest Android SDK and build tools (and whatever else you need) from the SDK Manager.
If you are working in Eclipse do the following:
In your AndroidManifest.xml file change android:targetSdkVersion to 23
Open Project settings (ALT + Enter while focused in Project Explorer)
Go to Android tab and in Project Build Target section mark Android 6.0
Clean and build your project
NOTE: when you do this have in mind that Android OS would treat your app as if it was designed to work on Android M. So for example if you use some dangerous permissions you should add routines to check then on runtime.
You have to update your SDK to the API 23 that is either not downloaded or not installed properly.
In your build.gradle set
compileSdkVersion 23
buildToolsVersion "23.0.0"
targetSdkVersion 23
compile 'com.android.support:appcompat-v7:23.0.0'
I actually found the answer for my problem and the person above was right. The Module SDK set to compile the module was 22.0 and not 23.0. To fix that I did the following.
Right click on appcompat: "Open Module Setting -> Modules SDK": New. I Chose the folder containing the whole Android SDK and chose the last Android (e.g. 6.0) with the last Module SDK 23.0.
Either revert to appcompact-v22 or update to android api v23
You have to update your SDK to the API 23 that is either not downloaded or not installed properly.
Make sure your compileSdkVersion and dependencies version should be same.
I was having problem with new appcompat V-23 as my target sdk is 21. So I did following two steps and it works perfectly for me..
1) Delete the values-23 folder in res folder.
2) I was getting error on the src folder as well, so commented the only line inside main() of snippet.java as we do not require it.
Then add this project as library to your project.. Hope it helps.
I resolved like below
android {
compileSdkVersion "Google Inc.:Google APIs:21"
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
}
replaced the above dependencies with below...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:7.8.0'
}
To correct this error in android studio procceded like this :
i went to sdk manager and i downloaded and updated all packages of android api 23
file => project structure and i changed compile sdk version from 21 to 23 and build tools version from 21 to 23
The problem generally occurs due to version issues. The following dependencies and compilesdkversion Worked for me:-
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:support-v13:23.0.+'
compile 'com.firebase:firebase-client-android:2.2.4+'
}
The answer #31 & #11 in this discussion can solve this issue:
https://code.google.com/p/android/issues/detail?id=183122
My issue was, one of my un-used dependencies was using sdk-23 version. So after removing those un-used dependencies it worked like a charm.
I'm trying to use the new CardView from Android L. I updated everything in the SDK manager, but I keep getting the following error:
Failure [INSTALL_FAILED_OLDER_SDK]
This is my build.gradle file:
apply plugin: 'android'
android {
compileSdkVersion 'android-L'
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "www.thomascbeerten.com.nieuwetests"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
// Support Libraries
compile 'com.android.support:support-v4:19.1.0'
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.android.support:gridlayout-v7:19.1.0'
compile 'com.android.support:mediarouter-v7:19.1.0'
// compile 'com.android.support:support-v13:19.1.0'
compile 'com.android.support:recyclerview-v7:+'
}
Recently there was a post here regarding the L SDK's incompatibility
with prior versions of Android. I've been digging in AOSP repositories
for quite a few hours now, and determined that the tools behave this
way because they are designed to treat preview platforms differently.
If you compile against a preview SDK (android-L), the build tools will
lock minSdkVersion and targetSdkVersion to that same API level. This
results in the produced application being unable to be installed on
devices running older releases of Android, even if your application
isn't doing anything specific to L. To make matters worse, the new
support libs (CardView, RecyclerView, Palette, etc.) are also locked
into the L API level, even though--according to their repository
names--they should work on API level 7 just fine (and they do!).
See my Reddit post about this here, with a workaround.
Once you have the above issues resolved as mentioned by Eddie. You might also run into another error;;
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.
This will be present in your styles.xml . The quick fix is to replace it with the following below:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--<style name="AppTheme" parent="android:Theme.Material.Light">-->
<style name="AppTheme" parent="android:Theme.Holo.Light">
</style>
Change
android {
compileSdkVersion 'android-L'
buildToolsVersion '20.0.0'
to
android {
compileSdkVersion 21
buildToolsVersion '21.0.2'
Note android-L is in single quotes but 21 isn't. 21 is an integer and not a string.
When you compile with L it actually makes a change during compilation setting your minsdkversion to L. If you want to use RecyclerView or CardView I would recommend checking out RecyclerViewLib. RecyclerView and CardView have been moving into this library so that there is no min version L problem. The author also explained in his blog post how all L related code was removed to make it safe to use.
To add RecyclerViewLb to your project just add the following line to your dependencies in your build.gradle file:
compile 'com.twotoasters.RecyclerViewLib:library:1.0.+#aar'
You then do not want to add the compile 'com.android.support:recyclerview-v7:+' to your build.gradle as you will get that through RecyclerViewLib.
I just ran into this problem. This can happen when your min sdk version and built targets are set to a higher API level/OS version than your phone is running. If you're using Android Studio, go to File > Project Structure > and edit relavent settings then Run again.