i try to add recyclerview to my project and get this error appear and i added it from android studio dependencies
问题:
回答1:
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" } } }
回答2:
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' }
回答3:
Just add this to your main all project level build.gradle file under allprojects()
maven { url "https://maven.google.com" }
回答4:
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.
回答5:
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.
回答6:
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() } }
回答7:
try to compile
compile 'com.android.support:cardview-v7:25.3.1'
回答8:
Update your Android Support Repository from sdk manager.
回答9:
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.gradleallprojects { repositories { google() jcenter() } }
回答10:
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' }
回答11:
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
回答12:
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.
回答13:
If you are using Android Studio 3.0 or above make sure your project build.gradle should have content similar to-
buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' } } allprojects { repositories { google() 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" } } }
check these links below for more details-
回答14:
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
回答15:
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
回答16:
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.
回答17:
compile 'com.android.support:cardview-v7:+'
This should pull the most recent version, and allow it to compile.
回答18:
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