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

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'

Related

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()
...
}

Failed to resolve: play-services-base

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"
}
}

i get gradle error when adding ( apply plugin: 'com.google.gms.google-services')

app level gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
//compile 'com.android.support:support-v4:23.1.1'
//compile 'com.android.support:mediarouter-v7:23.1.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-drive:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.0'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.android.support:design:23.4.0'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.google.android.gms:play-services-ads:10.0.1'
}
apply plugin: 'com.google.gms.google-services'
when I remove apply ( plugin: 'com.google.gms.google-services' )there is no problem but after adding it I get (Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.0.1.)
root level gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
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 {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Could not find com.google.gms:google-services:9.0.0

I am trying to get 'FCM' and 'GcmListenerService' working, i added the required dependencies to gradle files as shown below.
but when i tried to build the project, i received the below posted errors..
please let mek know how to fix it
build.gradle app:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':appcompat')
compile project(':securepreferences')
compile 'com.android.support:support-v4:25.2.0' // .0.1
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.github.chrisbanes.photoview:library:1.2.4'
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup:otto:1.3.8'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0' // 7.5'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.8.0'
compile files('app/libs/android-viewbadger.jar')
compile files('app/libs/iDappsImagesLib_v0.2.jar')
compile files('app/libs/iDappsToolsLib_v0.1.jar')
compile files('gradle/wrapper/gradle-wrapper.jar')
}
dependencies {
compile 'com.google.firebase:firebase-messaging:10.0.1'
}
apply plugin: 'com.google.gms.google-services'
build.grdle proj:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7' // 1.8?
classpath 'com.google.gms:google-services:9.0.0'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
error:
Error:Could not find com.google.gms:google-services:9.0.0.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/9.0.0/google-services-9.0.0.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/9.0.0/google-services-9.0.0.jar
https://jcenter.bintray.com/com/google/gms/google-services/9.0.0/google-services-9.0.0.pom
https://jcenter.bintray.com/com/google/gms/google-services/9.0.0/google-services-9.0.0.jar
https://repo1.maven.org/maven2/com/google/gms/google-services/9.0.0/google-services-9.0.0.pom
https://repo1.maven.org/maven2/com/google/gms/google-services/9.0.0/google-services-9.0.0.jar
Required by:
project :
The last google-services version is 3.1.0, so edit your build.gradle project file as follows:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
...
}
}
Then, in your build.gradle app file, you can use com.google.gms:google-services:9.0.0, but I think, actually the last version is 11.0.2, so I will recommend you to update
https://firebase.google.com/docs/android/setup
https://firebase.google.com/docs/android/setup#manually_add_firebase
Your app/build.gradle's dependencies looks fine, but make sure you have apply plugin: 'com.google.gms.google-services' at the root-bottom.
Your project/build.gradle does not. From docs:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.1.0'
}
}
Why do you have an extra classpath 'com.google.gms:google-services:9.0.0' in there?
Please review and double check your setup against the docs.

After update Android SDK platfrom-tools 24 "Could not find method apt()" why?

After update Android SDK platfrom-tools 24 occur this error :
Could not find method apt() for arguments
[com.jakewharton:butterknife-compiler:8.0.1] on
DefaultExternalModuleDependency{g
roup='com.android.support', name='appcompat-v7', version='24.0.0', configuration='default'}.
Top level build.gradle :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Project dependencies :
apply plugin: 'com.neenbedankt.android-apt'
def _androidSupport = "24.0.0"
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.1#aar'
compile 'com.daimajia.androidanimations:library:1.0.8#aar'
compile 'com.google.code.gson:gson:2.4'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.google.zxing:core:3.2.1'
compile 'me.dm7.barcodescanner:zxing:1.8.4'
compile 'com.jakewharton:butterknife:8.0.1'
compile 'org.greenrobot:greendao:2.2.0'
compile "com.android.support:support-v4:${_androidSupport}"
compile "com.android.support:recyclerview-v7:${_androidSupport}"
compile "com.android.support:design:24.0.0:${_androidSupport}"
}
Your dependencies block should include both of the following two lines:
dependencies {
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
}
Source

Categories

Resources