Android appcompat v7:23 - android

Today, Google released SDK 6 API 23+.
I tried to create a project with the API 23, but I'm having the following problem:
Failed to resolve: com.android.support:appcompat-v7:23.0
Here's my gradle file:
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "my.package"
minSdkVersion 17
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'])
wearApp project(':wear')
compile 'com.android.support:appcompat-v7:23.0'
compile 'com.google.android.gms:play-services:7.8.0'
}
In the SDK manager, the version 23 isn't listed to update:
How can I solve this?

Original answer:
I too tried to change the support library to "23". When I changed the targetSdkVersion to 23, Android Studio reported the following error:
This support library should not use a lower version (22) than the targetSdkVersion (23)
I simply changed:
compile 'com.android.support:appcompat-v7:23.0.0'
to
compile 'com.android.support:appcompat-v7:+'
Although this fixed my issue, you should not use dynamic versions. After a few hours the new support repository was available and it is currently 23.0.1.
Pro tip:
You can use double quotes and create a ${supportLibVersion} variable for simplicity. Example:
ext {
supportLibVersion = '23.1.1'
}
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:palette-v7:${supportLibVersion}"
compile "com.android.support:customtabs:${supportLibVersion}"
compile "com.android.support:gridlayout-v7:${supportLibVersion}"
source: https://twitter.com/manidesto/status/669195097947377664

As seen in the revision column of the Android SDK Manager, the latest published version of the Support Library is 22.2.1. You'll have to wait until 23.0.0 is published.
Edit: API 23 is already published. So u can use 23.0.0

Ran into a similar issue using React Native
> Could not find com.android.support:appcompat-v7:23.0.1.
the Support Libraries are Local Maven repository for Support Libraries

First you need to download the latest support repository (17 by the time I write this) 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.0' or any other support library you want to your build.gradle file. (Don't forget the last .0)

Latest published version of the Support Library is 24.1.1, So you can use it like this,
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
Same as for other support components.
You can see the revisions here,
https://developer.android.com/topic/libraries/support-library/revisions.html

Related

Android API not allowing application to be released on play store

I have just finished working with my android project and decided to publish it on Google Play Store. When I uploaded the signed APK file in the production tab of Google Play Console, I faced the following issue:
Here is the gradle information:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.parma.torupee"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:26.1.0'
compile 'com.jjoe64:graphview:4.2.1'
}
I have developed the application in Android Studio 3.0.1(did not update). I tried changing the targeted SDK to 29 but then I received errors for implementation 'com.android.support:appcompat-v7:26.1.0' and implementation 'com.android.support:design:26.1.0' lines in the gradle file.
How can I change the target SDK to 29 such that it supports the latest version and also support API level 26(Oreo)? Any help would be highly appreciated!
Compile SDK Version
The Compile SDK Version is the version of Android in which you write code. If you choose 9, you can write code with all the APIs in version 28.
Minimum SDK Version
Android operating system (OS) versions are backward-compatible. If your minSdkVersion is set to Android version 22, your application will run on Lolipop (5.1) and above .
Target SDK Version
You should set the targetSdkVersion to the most recent version of Android that you have tested on.
Whenever a new version of Android comes out, you will want to update the targetSdkVersion to the latest Android version and test your app to fix any problems. If you don’t google may force you to update it. This allows you to use the new security patches commonly applied for most of the OS versions.
Increasing your target sdk doesnt affect the minimum version number you have defined.
EDITED : Updated comment on support library
If you want to update your target SDK to 28 then it might be easier as you could use the below support libraries
com.android.support:support-compat:28.0.0 but if you plan to use target sdk as 29 then you have to migrate all your support packages to androidx libraries .
https://developer.android.com/topic/libraries/support-library/packages
For easier migration you could follow the stesp give here https://developer.android.com/jetpack/androidx/migrate
Let me know if this helps
You could use:
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.android.support:design:29.0.0'

Please explain gradle dependancies vs min build sdk

Android beginner here...
I'm getting all sort of rendering errors, and eventually concluded it's got something to do with my gradle dependencies.
Now I found a nice tutorial which I've been following, http://www.android4devs.com/2015/06/navigation-view-material-design-support.html but I'm running to a problem extending it further, and there is something I don't think I understand.
Should I not be using the latest stable version of any library I can? Surely these libraries are backwards compatible?
If I am supposed to use the older version of library, to match the compile sdk (which I understand to mean I'm compiling for backwards compatibility, and supporting, say, lollipop API 21-22) then:
I would need a place to see a complete list of all versions of all libraries (which I cannot find), and
I would not be able to use new features like RecyclerView which only came in at Marshmallow API 23.
Am I missing something?
build.gradle (module app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.example.myFirstApp"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
...
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.intuit.sdp:sdp-android:1.0.3'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
Error message
The support library should not use a different version (26) than the compile sdk version (22).
You are using
compileSdkVersion 22
and
compile 'com.android.support:appcompat-v7:26.1.0'
error you are getting is because you are using compat version 26 while compileSdkversion is 22
You should update to compileSdkVersion to 26 and android studio will download required files so that your error will be removed. If you cannot update your compilesdk version to 26. Then change support library version to 22.2.1
compile 'com.android.support:appcompat-v7:22.2.1'
Got list of support libraries from link
https://developer.android.com/topic/libraries/support-library/rev-archive.html
and
https://developer.android.com/topic/libraries/support-library/revisions.html

Android Studio Build.Gradle Sync Error

I am experiencing a problem building my application in Android Studio. I am using Android Studio 2.2 Preview 7. When I start up my Android Studio it gives an error:
The plugin is too old, please update to a more recent version, or set
ANDROID_DAILY_OVERRIDE environment variable to xxxxxxx.
It requests I fix plugin version and sync project. I have made all the required updates but the error remains. I have read similar questions on the issue but they don't seem to apply to my case.
Could you please assist in providing me with a working solution?
Here is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.mobileappdev.novarttech.sunshine"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4'
compile 'com.android.support:design:23.3.0'
testCompile 'junit:junit:4.12'
}
As per my observation it seems like you haven't updated Android SDK platform to version 25. First of all download and install android sdk platform and build tools from SDK Manager and use the following lines in your build.gradle(module app)
compileSdkVersion 25
buildToolsVersion "25.0.0"
Also update dependencies according to that. It should work then
As #claudio-redi says, you need to upgrade your build gradle tools.
Use build tools 2.2.2 to your root build.gradle:
classpath 'com.android.tools.build:gradle:2.2.2'
And change the gradle distribution to 2.14.1 in gradle/wrapper/gradle-wrapper.properties file with:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
Or if you already have download the gradle distribution and place it in a directory, you can set it in your Android Studio from menu File->Setting->Gradle and set it as the following image:
Please be noted when you want to use API Level 25 you need to make sure that compileSdkVersion, buildToolsVersion, targetSdkVersion, and Support Library using the same API Level 25.

Gradle not picking right appcompat-v7:22.2.1

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 .

RecyclerView cannot resove for appcompat-v7:23.0.0 and 22

I'm trying to create a new list using RecyclerView to convert my existing ListView but problem is I can't find why my app cannot import the RecyclerView. I've just updated my SDK and other tools so I can work with Marshmallow in the future so everything is updated.
What I have in my app build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23"
defaultConfig {
applicationId "com.test.recyclerview"
minSdkVersion 15
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'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.android.support:percent:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
}
and after adding this line on my layout xml I got the error saying The following classes could not be found: -android.support.v7.widget.RecyclerView
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
Downgrading my buildtools and targetSDK version is quite not a good option for me since I only have version 22 and 23 but in case I tried to downgrade my app compat version into 21 it result into this error:
This support library should not use a lower version (21) than the targetSdkVersion (23)
Does it mean that the RecyclerView is removed from app compat 23? or I missed something here?
It appears that something was messed out with my configuration which cause is still unknown. It may be on the IML file or other part but it appears that the libraries are not being imported from the source which is why even after I sync and clean the gradle project the libraries from external source remains the same and still builds successfully.
This may be a stupid question but it's the only thing I can imagine is happening
You said that you had downloaded Marshmallow API but have you downloaded the Android Support Library?
The RecyclerView is part of the support library, not the "normal" SDK

Categories

Resources