Add Google Maven repository to Android Studio Project

Add Google Maven repository to Android Studio Project

With latest Android Studio, I change the targetSdkVersion and compileSdkVersion of my old exercise to 28. And I also have to use updated com.android.support:appcompat-v7 and com.android.support.constraint:constraint-layout. After fail in rebuild, it’s a number of WARNING and ERROR.

—————————–
ERROR: Failed to resolve: com.android.support:appcompat-v7:28.0.0
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app

ERROR: Failed to resolve: com.android.support.constraint:constraint-layout:1.1.3
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app

WARNING: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: app

WARNING: Configuration ‘testCompile’ is obsolete and has been replaced with ‘testImplementation’.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: app

WARNING: Configuration ‘androidTestCompile’ is obsolete and has been replaced with ‘androidTestImplementation’.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: app
—————————–

As suggested, I change  ‘compile’, ‘testCompile’ and ‘androidTestCompile’ to ‘implementation’, ‘testImplementation’ and ‘androidTestImplementation’, in app/build.gradle.

To fix the error of Failed to resolve: com.android.support:appcompat-v7:28.0.0 and com.android.support.constraint:constraint-layout:1.1.3, I add the follow lines of Google Maven repository to build.gradle.

        maven {
url 'https://maven.google.com/'
name 'Google'
}

And rebuild the project. At least it works for me now.

Add Google Maven repository to Android Studio Project Posted first on ” Android-er “
Author: Andr.oid Eric

Author: Pawan Kumar

Leave a Reply

Close Menu
%d bloggers like this:
Skip to toolbar