Related
i try to add recyclerview to my project and get this error appear and i added it from android studio dependencies
Starting from version 26 of support libraries make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint.
Something like;
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
This is how I have it working.
Add maven { url "https://maven.google.com" } as #Gabriele_Mariotti suggests above.
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Then on the build.gradle file inside the App folder add
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.xxx.yyy"
minSdkVersion 16
targetSdkVersion 26
}
Then on the dependencies use
dependencies {
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:cardview-v7:26.0.1'
}
If you are using Android Studio 3.0 or above make sure your project build.gradle should have content similar to-
buildscript {
repositories {
google() // add google() before jcenter()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google() // add google() before jcenter()
jcenter()
}
}
And for below Android Studio 3.0 and starting from support libraries 26.+ your project build.gradle must look like this-
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Note- position really matters add google() before jcenter()
check these links below for more details-
1- Building Android Apps
2- Add Build Dependencies
3- Configure Your Build
Just add this to your main all project level build.gradle file under allprojects()
maven {
url "https://maven.google.com"
}
I face the same problem while I have updated my SDK and Android studio version(3.0 beta). I have solved this problem going through this tutorial. In this they told us to update are build configuration file like
android {
compileSdkVersion 26
buildToolsVersion '26.0.0'
defaultConfig {
targetSdkVersion 26
}
...
}
dependencies {
compile 'com.android.support:appcompat-v7:26.0.0'
}
// REQUIRED: Google's new Maven repo is required for the latest
// support library that is compatible with Android 8.0
repositories {
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
Hope it will help you out.
in may case I found OneSignal changed their dependencies
so I changed it from
compile 'com.onesignal:OneSignal:[3.5.8, 3.99.99]'
to
compile 'com.onesignal:OneSignal:[3.5.8, 3.5.8]'
then it works, please check any unspecific dependency.
Add this to the project level build.gradle file and it should work fine.
allprojects {
repositories {
google() // this is to be added if there's something already.
jcenter()
}
}
Google's new Maven repo is required for the latest support library that is compatible with Android 8.0.
Just update your Google's Maven repository like below:
To add them to your build, add maven.google.com to the Maven repositories in your module-level build.gradle file:
repositories {
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
Alternative you can update build.gradle file like this:
repositories {
jcenter()
google()
}
Then add the desired library to your dependencies block. For example, the cardview library looks like this:
dependencies {
compile 'com.android.support:cardview-v7:26.1.0'
}
in sdk 28
u can use
implementation 'com.android.support:design:28.0.0'
and remove cardView library
Update your Android Support Repository from sdk manager.
There is another way to add google repository
Add gradle-4.1-rc-1-all in gradle-wrapper.properties.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip
Then add google() in the top-level build.gradle
allprojects {
repositories {
google()
jcenter()
}
}
Simply change the build-version from
compile 'com.android.support:appcompat-v7:26.0.0'
to
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
This will solve your problem.
If the other solutions here do not work, make sure you are not in 'offline' mode. If enabled, android will not download the required files and you will get this error.
try to compile
compile 'com.android.support:cardview-v7:25.3.1'
Clean your gradle from terminal
./gradlew clean
then use this code in your build.gradle section
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Make sure, your included library version is available. For your checking, you can use this link
I had this issue when creating a new project in Android Studio using Kotlin. The way that finally helped me:
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
google()
jcenter()
}
}
Ionic 4, opened /platforms/android/platform.properties, changed the version of the listed library throwing the error (in my case, com.android.support:support-v4:27.+) to:
com.android.support:support-v4:28.+
Use compile 'com.android.support:cardview-v7:25.4.0'
If you want version 26 you should use compile 'com.android.support:cardview-v7:26.0.0-beta2', because it is beta for now
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.test"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
this is working for me
compile 'com.android.support:cardview-v7:+'
This should pull the most recent version, and allow it to compile.
try this,
goto Android->sdk make sure you have all depenencies required . if not , download them . then goto File-->Settigs-->Build,Execution,Depoyment-->Gradle
choose use default gradle wapper (recommended)
and untick Offline work
gradle build finishes successfully for once you can change the settings
May be this problem is due to facebook library.
Replace
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
by
compile 'com.facebook.android:facebook-android-sdk:4.26.0'
#Aryan is correct Failed to resolve: com.android.support:appcompat-v7:27.+ (Dependency Error)
A picture worth thousand words
2 Steps to fix this..
1, connect to internet.
2, Click on clean project. this will fix it
:)
For me I just had to clean my project.
Build -> Clean Project
Another time I had to:
File -> Sync Project with Gradle Files.
When you sync this dependency to the android studio:
implementation 'com.android.support:cardview-v7:26.0.1-alpha1'
Then, Sync the Gradle with Project Files.
It will say, (Suppose if you are working on new ones like androidx) obviously, it will show error on the dependency.
For that you can go to the File menu and click on the invalidate/restart the code. It will resolve itself and the application will restart without any error.
I am using a beta Kotlin and Android-Studio channel. After update to the latest version i got some gradle sync error.
Below are the log i copied from Event Log:
Error:Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0-rc-39.
Searched in the following locations:
file:/home/yourpc/Android/android/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom
file:/home/yourpc/Android/android/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar
https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom
https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar
Required by:
project :
below is the build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.0-rc-39'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-alpha04'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// 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
}
below is the app build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.udebest.myapplication"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
postprocessing {
removeUnusedCode false
removeUnusedResources false
obfuscate false
optimizeCode false
proguardFile 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Please, anyone has an idea about this? I don't really know how can I solve this? I could not find any solutions out there.
Change your repositories in buildscript and allprojects into:
{
google()
jcenter()
mavenCentral()
maven {
url 'https://dl.bintray.com/kotlin/kotlin-dev/'
}
}
This works for me.
First, I updated Kotlin plugin thru tool, Kotlin, configure kotlin plugin update.
After, in App directory, in build.Gradle file search:
repositories {
// You need to add the following repository to download the
// new plugin.
google()
}
I add a new repository
maven { url 'C:/Program Files/Android/Android Studio/gradle/m2repository/'}
this is the path thru my local directory where the resources are. After this try again to sync
Change and try
classpath 'com.android.tools.build:gradle:3.1.0-alpha04'
to
classpath 'com.android.tools.build:gradle:3.0.0'
It may be due to the alpha release of gradle.
Use below version of kotlin in build.gradle(Project)
kotlin_version = '1.1.4-3'
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Declare dependency of kotlin in build.gradle(Module) as below
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
check your Kotlin version in build.gradle.
I got the same issue when the version was 1.1.0 which was added by default.
changed to recent version 1.3.21 then it is working fine.
This solution has worked for me for React Native(0.63) after installing react-native-image-picker by Ray Eldath, from above comment
//in android.build.gradle
{
google()
jcenter()
mavenCentral()
maven {
url 'https://dl.bintray.com/kotlin/kotlin-
dev/'
}
}
First, close Android studio, delete the .gradle folder, and then open Android Studio again, probably as an administrator
This will make it sync from the start, and solve the issue.
This issue was resolved for one of my peers.
Uninstall the Kotlin plugin (Preferences > Plugins > Kotlin > Uninstall) and use the version that comes with the IDE .
i try to add recyclerview to my project and get this error appear and i added it from android studio dependencies
Starting from version 26 of support libraries make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint.
Something like;
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
This is how I have it working.
Add maven { url "https://maven.google.com" } as #Gabriele_Mariotti suggests above.
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Then on the build.gradle file inside the App folder add
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.xxx.yyy"
minSdkVersion 16
targetSdkVersion 26
}
Then on the dependencies use
dependencies {
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:cardview-v7:26.0.1'
}
If you are using Android Studio 3.0 or above make sure your project build.gradle should have content similar to-
buildscript {
repositories {
google() // add google() before jcenter()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google() // add google() before jcenter()
jcenter()
}
}
And for below Android Studio 3.0 and starting from support libraries 26.+ your project build.gradle must look like this-
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Note- position really matters add google() before jcenter()
check these links below for more details-
1- Building Android Apps
2- Add Build Dependencies
3- Configure Your Build
Just add this to your main all project level build.gradle file under allprojects()
maven {
url "https://maven.google.com"
}
I face the same problem while I have updated my SDK and Android studio version(3.0 beta). I have solved this problem going through this tutorial. In this they told us to update are build configuration file like
android {
compileSdkVersion 26
buildToolsVersion '26.0.0'
defaultConfig {
targetSdkVersion 26
}
...
}
dependencies {
compile 'com.android.support:appcompat-v7:26.0.0'
}
// REQUIRED: Google's new Maven repo is required for the latest
// support library that is compatible with Android 8.0
repositories {
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
Hope it will help you out.
in may case I found OneSignal changed their dependencies
so I changed it from
compile 'com.onesignal:OneSignal:[3.5.8, 3.99.99]'
to
compile 'com.onesignal:OneSignal:[3.5.8, 3.5.8]'
then it works, please check any unspecific dependency.
Add this to the project level build.gradle file and it should work fine.
allprojects {
repositories {
google() // this is to be added if there's something already.
jcenter()
}
}
Google's new Maven repo is required for the latest support library that is compatible with Android 8.0.
Just update your Google's Maven repository like below:
To add them to your build, add maven.google.com to the Maven repositories in your module-level build.gradle file:
repositories {
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
Alternative you can update build.gradle file like this:
repositories {
jcenter()
google()
}
Then add the desired library to your dependencies block. For example, the cardview library looks like this:
dependencies {
compile 'com.android.support:cardview-v7:26.1.0'
}
in sdk 28
u can use
implementation 'com.android.support:design:28.0.0'
and remove cardView library
Update your Android Support Repository from sdk manager.
There is another way to add google repository
Add gradle-4.1-rc-1-all in gradle-wrapper.properties.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip
Then add google() in the top-level build.gradle
allprojects {
repositories {
google()
jcenter()
}
}
Simply change the build-version from
compile 'com.android.support:appcompat-v7:26.0.0'
to
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
This will solve your problem.
If the other solutions here do not work, make sure you are not in 'offline' mode. If enabled, android will not download the required files and you will get this error.
try to compile
compile 'com.android.support:cardview-v7:25.3.1'
Clean your gradle from terminal
./gradlew clean
then use this code in your build.gradle section
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Make sure, your included library version is available. For your checking, you can use this link
I had this issue when creating a new project in Android Studio using Kotlin. The way that finally helped me:
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
google()
jcenter()
}
}
Ionic 4, opened /platforms/android/platform.properties, changed the version of the listed library throwing the error (in my case, com.android.support:support-v4:27.+) to:
com.android.support:support-v4:28.+
Use compile 'com.android.support:cardview-v7:25.4.0'
If you want version 26 you should use compile 'com.android.support:cardview-v7:26.0.0-beta2', because it is beta for now
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.test"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
this is working for me
compile 'com.android.support:cardview-v7:+'
This should pull the most recent version, and allow it to compile.
try this,
goto Android->sdk make sure you have all depenencies required . if not , download them . then goto File-->Settigs-->Build,Execution,Depoyment-->Gradle
choose use default gradle wapper (recommended)
and untick Offline work
gradle build finishes successfully for once you can change the settings
May be this problem is due to facebook library.
Replace
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
by
compile 'com.facebook.android:facebook-android-sdk:4.26.0'
#Aryan is correct Failed to resolve: com.android.support:appcompat-v7:27.+ (Dependency Error)
A picture worth thousand words
2 Steps to fix this..
1, connect to internet.
2, Click on clean project. this will fix it
:)
For me I just had to clean my project.
Build -> Clean Project
Another time I had to:
File -> Sync Project with Gradle Files.
When you sync this dependency to the android studio:
implementation 'com.android.support:cardview-v7:26.0.1-alpha1'
Then, Sync the Gradle with Project Files.
It will say, (Suppose if you are working on new ones like androidx) obviously, it will show error on the dependency.
For that you can go to the File menu and click on the invalidate/restart the code. It will resolve itself and the application will restart without any error.
I installed the Kotlin plugin into my app (v. v1.1.1-release-Studio2.2-1) and then selected "Configure Kotlin in Project" I selected compiler and runtime version of 1.0.7. Kotlin updated my Gradle files. Now when I try to build in I get:
Error: A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7:1.0.7.
Required by:
MyApplication:app:unspecified
I'm not sure what I'm missing here.
replace
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
^
|
JRE = Java Runtime Environment
with
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
^
|
JDK = Java Development Kit
Since the version with jre is absolute , just replace and sync the project
Official Documentation here Thanks for the link # ROMANARMY
In Project level build.gradle use only this version
ext.kotlin_version = '1.3.31'
Remove other versions
This will only work with the latest version of android studio 3.4
UPDATE: Try to use the latest version of kotlin with latest Android studio to avoid an error.
The split of kotlin-stdlib into kotlin-stdlib-jre7 and kotlin-stdlib-jre8 was only introduced with Kotlin 1.1, that's why the dependency cannot be resolved, the package version simply does not exist.
It looks like the update to your project files failed at some point and set the Kotlin version to 1.0.7. If this is a new project and there's nothing holding you back from using 1.1.1, I'd switch to that. Your problem should be gone after doing this.
If you hereafter removing Jcenter from Gradle then add this to your gradle
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
So main point is that, add mavenCentral() and maven { url "https://jitpack.io" } in gradle
In "build.gradle" file, change current Kotlin version that line and press synk:
ext.kotlin_version = '1.1.1'
/// That will look like:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.1'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
A new solution if you use Android Studio 3.2, I solved this issue by added mavenCentral() to build.gradle of the project:
buildscript {
ext.kotlin_version = '1.3.0'
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
mavenCentral()
google()
jcenter()
}
}
You should add the line as this order, the credited is for this answer
Starting with Kotlin 1.1.2, the dependencies with group org.jetbrains.kotlin are by default resolved with the version taken from the applied plugin. You can provide the version manually using the full dependency notation like:
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
If you're targeting JDK 7 or JDK 8, you can use extended versions of the Kotlin standard library which contain additional extension functions for APIs added in new JDK versions. Instead of kotlin-stdlib, use one of the following dependencies:
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
buildscript {
**ext.kotlin_version = '1.1.1'** //Add this line
repositories {
**jcenter()** //Add this line
google()
}
dependencies {
// classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
**jcenter()** //Add this line
google()
maven { url "https://jitpack.io" }
}
}
I have solved this issue using deselection of the Offline work option in Settings
This is what worked for me:
Using Gradle 4.8.1
buildscript {
ext.kotlin_version = '1.1.1'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'}
}
allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven {
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://dl.bintray.com/kotlin/kotlin-dev/'
}
}
}
If you are using Android Studio 3.2 & above,then issue will be solved by adding google() & jcenter() to build.gradle of the project:
repositories {
google()
jcenter()
}
Please check current version of your Kotlin in below path,
C:\Program Files\Android\Android Studio\gradle\m2repository\org\jetbrains\kotlin\kotlin-stdlib\1.0.5
change to that version (1.0.5) in project level gradle file.
You can see in your above path does not mentioned any Java - jre version, so remove in your app level gradle file as below,
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
build.gradle (Project)
buildScript {
...
dependencies {
...
classpath 'com.android.tools.build:gradle:4.0.0-rc01'
}
}
gradle/wrapper/gradle-wrapper.properties
...
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Some libraries require the updated gradle. Such as:
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines"
GL
In case a (transitive) dependency still uses the jre variant of the Kotlin library, you can force the use of the jdk variant with the help of a resolution strategy:
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
details.requested.with {
if (group == "org.jetbrains.kotlin" && name.startsWith("kotlin-stdlib-jre")) {
details.useTarget(group: group, name: name.replace("jre", "jdk"), version: version)
details.because("Force use of 'kotlin-stdlib-jdk' in favor of deprecated 'kotlin-stdlib-jre'.")
}
}
}
}
}
After fixing the build.gradle version, It started working
4.0.0 to 3.5.0
Reload sdk maybe the problem is solved
Simple Steps:
Click File > Project Structure
Click Dependencies >
Find and Click org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21 (or whatever your current version is)
Under Details > update section, click [update variable][update
dependencies]
Click Ok
In my case problem solved by adding the following lines in build.gradle file:
allprojects {
repositories {
jcenter()
google()
maven { url "https://jitpack.io" } //remember to add this line
}
}
Running a project in Android Studio fails with this error: could not find any version that matches com.android.support:appcompat-v7:+
How can I fix this error?
From Android Studio go to:
Tools >> Android >> SDK Manager
Select and install "Extras|Android Support Repository"
For me it worked after changing the version from 7:27.+ to 7:+
In Project > app > build.gradle file replace the line
implementation 'com.android.support:appcompat-v7:+'29.+'
with
implementation 'com.android.support:appcompat-v7:+'
and line
implementation 'com.android.support:design:29.+'
with
implementation 'com.android.support:design:+'
Then clean build
Also as as said on How to update Android platform-tools in a headless linux?
android list sdk
android update sdk --no-ui --filter extra
It is very simple.
Kindly update and replace the below code in build.gradle(Project :App Name).
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
After installing Extras|Android Support Repository, It does not work for me. Then I change v7:1.6 to v7:1.8 in the app build.gradle file.
com.android.support:appcompat-v7:1.8.+! and It works for me.
Open SDK Manager.exe in your Android Studio folder and install a matching API.
I found all these answers incorrect for me. Instead in your android studio look below on the left. There will be some help for this.
For example, you will notice
This support library should not use a different version (32) than the compilesdkVersion (23)
Then you change the version of to 23 like this
compile 'com.android.support:support-v4:23'
Now, you will see a message
A newer version of com.android.support-v4 than 23 is available 23.4.0.
Thats how I knew that the correct version is 23.4.0
If you see this after you've just created a new project in Intellij then try to recreate it again with "Use AndroidX artifacts" checked
To whom came here for same error but version 29, change your support library to version 28:
build.gradle(app):
dependencies {
...
implementation 'com.android.support:appcompat-v7:28.+'
...
}
None of googled solutions worked for me. Then I saw Android has only support library up to version 28. It is weird that I got this error in an out-of-box created Android Studio project.
I'm not sure which Android Studio version was, cause I upgraded Studio after got error. Now in Android Studio 3.6.3, new projects coming with 'androidx.appcompat:appcompat:1.0.2'.
This worked for me to build and run this project.
I had to add google in both sections.
build.gradle (project)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "29.0.2" //25.0.2"
defaultConfig {
applicationId 'com.github.nkzawa.socketio.androidchat'
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
////noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:25.0.+'
////noinspection GradleCompatible
implementation 'com.android.support:recyclerview-v7:25.0.+'
implementation ('io.socket:socket.io-client:0.8.3') {
exclude group: 'org.json', module: 'json'
}
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
}
Got the same error but version 26.
Downloading the libraries through the SDK Manager is no longer supported. The support libraries are now available through Google's Maven repository.
Solution:
In build.gradle (project) inside both buildscript/repositories and allprojects/repositories add this:
maven {
url 'https://maven.google.com/'
name 'Google'
}
Result:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
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 {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
It worked for me.