Failed to resolve: play-services-base - android

The error is not allowing gradle build to be successful.
My project level is below:
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.24.4'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My app level gradle file dependencies
dependencies
{
implementation 'com.android.support:support-v4:28.0.0-alpha3'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
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.google.firebase:firebase-messaging:17.0.0'
implementation 'com.android.support:design:28.0.0-alpha3'
testCompile 'junit:junit:4.12'
implementation 'com.startapp:inapp-sdk:3.8.1'
implementation 'com.android.support:gridlayout-v7:28.0.0-alpha3'
implementation 'com.android.support:support-v4:28.0.0-alpha3'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
My Google Repository version is 58, Android Support Repository is 47.0.0, Android SDK Build Tools is 28.0.0

If you are using windows just delete .gradle folder in C:\users\"username"
I don't ever had android studio in Linux or Mac, but it must be: ~/.gradle
My issue solved this way.

Take care of order where you put google()
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}

Related

Fail to resolve com.github [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I am trying to build my android project in android studio 3.0.1 but before it loads completely it shows me error Fail to resolve com.github and When i click on Show in file cursor points me to implementation 'com.github.clans:fab:1.6.2' this dependency in build.gradle(Module:app)
this is my build.gradle (Module App).
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "xxx.xx.xxxx"
minSdkVersion 21
targetSdkVersion 28
versionCode 5
versionName "2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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.github.clans:fab:1.6.2'
implementation 'com.android.volley:volley:1.1.0'
implementation('es.voghdev.pdfviewpager:library:1.0.4') {
exclude group: 'com.android.support'
exclude module: 'appcompat-v7'
exclude module: 'support-v4'
}
implementation 'com.github.rieved :glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
//implementation 'com.github.bumptech.glide:okhttp3-integration:1.4.0#aar'
implementation 'com.google.android.ads.consent:consent-library:1.0.6'
implementation 'com.android.support:design:28.0.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.android.gms:play-services-ads:16.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:multidex:1.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'org.jsoup:jsoup:1.8.3'
implementation 'com.github.darsh2:MultipleImageSelect:v0.0.4'
api 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.github.florent37:tutoshowcase:1.0.1'
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'
implementation 'com.linsea:universalvideoview:1.1.0#aar'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
implementation 'com.google.firebase:firebase-perf:16.2.3'
}
apply plugin: 'com.google.gms.google-services'
i have surfed on net and i have tried different solutions like adding
allprojects {
repositories {
google()
jcenter()
}
}
this is my build.gradle (gradle.properties)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.26.1'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://jitpack.io"
}
maven{
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
but this does not work.
Finally, I got the issue. The main issue is you have a space in your dependency implementation on this line
implementation 'com.github.rieved :glide:4.8.0'
Remove this line from dependency and add this for using Glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
Hope this will solve your problem.

Can't build consent-library:1.0.7

I can't build my Project when I add I follow [https://developers.google.com/admob/android/eu-consent]
I got below error!
Unable to resolve dependency for ':app#debug/compileClasspath': Could
not resolve com.google.android.ads.consent:consent-library:1.0.7.
buildscript {
repositories {
jcenter()
google()
// maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.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.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
implementation 'com.google.android.ads.consent:consent-library:1.0.7'
}
there only is a version 1.0.6, as the link you've provided states:
implementation "com.google.android.ads.consent:consent-library:1.0.6"
for it to work, you'd also need to add this plugin to the buildscript dependencies:
classpath "com.google.gms:google-services:4.2.0"
and apply that plugin at the bottom of the file:
apply plugin: "com.google.gms.google-services"
and a google-services.json file needs to be added to the project, which provides the ga_trackingId... see the documentation.

In my project it failed to add "firebase" to android studio

I was adding firebase to my project as documented in the official website.
In the 4th step it says to add compile 'com.google.firebase:firebase-core:16.0.0'.
But trying to synch gradle I would get errors:
and by trying to download them (install repository abd synch project) I would get this error:
here is my gradle dependencies:
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.1'
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.google.android.gms:play-services-gcm:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.google.firebase:firebase-auth:11.6.2'
compile 'com.google.android.gms:play-services-auth:15.0.1'
compile 'com.google.code.gson:gson:2.7'
compile('io.socket:socket.io-client:1.0.0') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
compile 'com.onesignal:OneSignal:3.6.5'
compile 'com.android.volley:volley:1.0.0'
testCompile 'junit:junit:4.12'
}
this answer did not work either:
this
update
My project-level gradle:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.0.1'
// 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' }
mavenCentral()
google()
}
}
Upgrade the following:
implementation 'com.google.firebase:firebase-auth:11.6.2'
into this:
implementation 'com.google.firebase:firebase-auth:16.0.2'
Add google service plugin version 4.0.1 and google() repo in top level gradle file:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
}
}
allprojects {
// ...
repositories {
// ...
google() // Google's Maven repository
}
}
Use same versions of firebase services to avoid conflicts.
Refer https://firebase.google.com/docs/android/setup
To solve your problem.
Before you proceed, clean and rebuild your project.
Then at app/build.gradle,
add apply plugin: 'com.google.gms.google-services'
like the code snippet down below.
android {
// ...
}
dependencies {
// ...
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
And make sure all the library used are as here.
Hope it helps!
Add firebase-core to your dependencies block:
implementation 'com.google.firebase:firebase-core:16.0.1'
The Firebase SDK release notes for the June 12 release explain:
Your app gradle file now has to explicitly list
com.google.firebase:firebase-core as a dependency for Firebase
services to work as expected.
It's also safer to list google() first in repository lists:
repositories {
google()
jcenter()
...
}

Butter Knife Build Gradle

Using Android Studio 3.1.1, I'm try to add Butter Knife to project but build gradle fail.
the module level:
{ ...
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'}
And below is the build project level:
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
enter image description here
I recreated the new project from scratch and tested any solutions everybody said, but it does not work and still it does fail with this message:
Failed to resolve: support-compat
Eraser all your changes and just add:
dependencies {
.
.
.
.
.
.
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
Downgrad to
implementation 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
and classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
your problem is you added extra implementation keyword in your dependencies, change your project dependencies with code below
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
Ad this in your project level gradle
repositories {
google()
jcenter()
maven { name 'Sonatype SNAPSHOTs'; url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT' // here
}
And apply plugin on app level gradle file
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'//here

Android Execution failed for task app.compileDebugKotlin when firebase is used

Getting this error
Error:Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details
As soon as I add this line of code to the app
firebaseAuth = FirebaseAuth.getInstance()
Dependency is added to gradle app module
compile 'com.google.firebase:firebase-auth:10.0.1'
Any idea what's causing this error?
EDIT
: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class com.google.firebase.auth.FirebaseAuth, unresolved supertypes: com.google.android.gms.internal.zzbql
but I do have it
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:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'io.reactivex:rxkotlin:0.21.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.dagger:dagger:2.4'
testCompile 'junit:junit:4.12'
kapt 'com.google.dagger:dagger-compiler:2.4'
provided 'org.glassfish:javax.annotation:10.0-b28'
}
**Project gradle**
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.2-5'
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
**app gradle**
dependencies {
implementation 'com.google.firebase:firebase-auth:11.0.2'
implementation 'com.google.firebase:firebase-database:11.0.2'
implementation 'com.google.firebase:firebase-ads:11.0.2'
implementation 'com.google.android.gms:play-services-location:11.0.2'
}
**Please add this below dependencies and make sure firebase and play-services versions should be same.**
apply plugin: 'com.google.gms.google-services'

Categories

Resources