Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android app not responding after adding apply plugin: 'com.google.gms.google-services' #229

Closed
salismt opened this issue May 26, 2016 · 29 comments

Comments

@salismt
Copy link

salismt commented May 26, 2016

I want to integrate my app with Firebase SDK in my Android app to use Firebase Remote config
It requires me to include apply plugin: 'com.google.gms.google-services' at the bottom of app/build.gradle
however when I add it, if I reopen my app a couple times, the app would stop responding
what is the plugin do in my app that might cause the app stop responding?

here is my project gradle

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        classpath 'com.newrelic.agent.android:agent-gradle-plugin:5.6.0'
        classpath 'io.fabric.tools:gradle:1.21.6'
        classpath 'me.tatarka:gradle-retrolambda:3.2.5'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'com.google.gms:google-services:3.0.0'

    }
}

here is my app gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'newrelic'
apply plugin: 'com.neenbedankt.android-apt'


android {

    useLibrary 'org.apache.http.legacy' 

    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }

    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'LICENSE.txt'
        exclude 'META-INF/ASL2.0'
    }

    signingConfigs {
        debug {
            storeFile file("debug.keystore")
        }
    }

    dexOptions {
        javaMaxHeapSize "4096M"
        preDexLibraries = false
    }

    allprojects {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
        }
    }

    compileSdkVersion project.ext.compileSdkVersion
    buildToolsVersion project.ext.buildToolsVersion
    defaultConfig {
        applicationId "xxxxxxx"
        resValue "string", "xxx", "xxx"
        buildConfigField "String", "xxx", "\"xxx\""
        minSdkVersion project.ext.minSdkVersion
        targetSdkVersion project.ext.targetSdkVersion
        versionCode project.ext.versionCode
        versionName project.ext.versionName
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    dataBinding {
        enabled = true
    }

    buildTypes {
        debug {
            ext.enableCrashlytics = false
            minifyEnabled false
            debuggable true
        }
    }

    compileOptions {
        encoding "UTF-8"
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(path: ':xxx', configuration: 'debug')
    compile project(path: ':xxx', configuration: 'debug')
    compile project(path: ':xxx', configuration: 'debug')
    compile(group: 'com.zendesk', name: 'sdk', version: '1.5.0.3') {
        exclude group: 'com.squareup.okhttp'
    }
    compile "com.android.support:design:23.3.0"
    compile "com.android.support:recyclerview-v7:23.3.0"
    compile "com.android.support:appcompat-v7:23.3.0"
    compile "com.android.support:cardview-v7:23.3.0"
    compile "com.android.support:support-v4:23.3.0"
    compile "com.mcxiaoke.volley:library:1.0.+"
    compile "com.squareup.okhttp:okhttp:2.6.0"
    compile "com.squareup.okhttp:okhttp-urlconnection:2.6.0"
    compile "com.squareup.okio:okio:1.6.0"
    compile "io.reactivex:rxandroid:1.1.0"
    compile "io.reactivex:rxjava:1.1.3"
    compile "com.github.bumptech.glide:glide:3.6.1"
    compile("com.github.bumptech.glide:okhttp3-integration:1.4.0") {
        exclude group: 'glide-parent'
    }
    compile "com.mixpanel.android:mixpanel-android:4.6.4"
    compile "com.appsflyer:af-android-sdk:4.3.7@aar"
    compile "com.google.code.gson:gson:2.3.1"
    compile "com.google.maps.android:android-maps-utils:0.3.+"
    compile "com.google.android.gms:play-services:9.0.0"
    compile "com.newrelic.agent.android:android-agent:5.6.0"
    compile "com.facebook.android:facebook-android-sdk:4.1.0"
    compile "com.airbnb:deeplinkdispatch:1.5.0"
    compile "com.airbnb:deeplinkdispatch-processor:1.5.0"
    compile "org.greenrobot:eventbus:3.0.0"
    compile "com.bignerdranch.android:expandablerecyclerview:1.0.3"
    compile "com.google.dagger:dagger:2.0.2"
    compile("com.jakewharton:butterknife:8.0.1") {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    apt "com.google.dagger:dagger-compiler:2.0.2"
    apt ("com.jakewharton:butterknife-compiler:8.0.1") {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    apt "com.google.guava:guava:19.0"
    provided "org.glassfish:javax.annotation:10.0-b28"

    compile "com.squareup.okhttp3:okhttp:3.2.0"
    compile "com.squareup.okhttp3:logging-interceptor:3.2.0"
    compile "com.squareup.okhttp3:okhttp-urlconnection:3.2.0"
    compile "com.squareup.retrofit2:retrofit:2.0.2"
    compile "com.squareup.retrofit2:converter-gson:2.0.2"
    compile "com.squareup.retrofit2:adapter-rxjava:2.0.2"

    testCompile "junit:junit:4.12"
    testCompile "org.mockito:mockito-core:1.10.19"

    androidTestCompile "junit:junit:4.12"
    androidTestCompile "org.mockito:mockito-core:1.10.19"
    androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2"
    androidTestCompile "com.squareup.okhttp3:mockwebserver:3.2.0"
    androidTestCompile "com.airbnb:deeplinkdispatch:1.5.0"
    androidTestCompile("com.android.support.test:runner:0.5") {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    androidTestCompile("com.android.support.test:rules:0.5") {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    androidTestCompile("com.android.support.test.espresso:espresso-core:2.2.1") {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    androidTestCompile("com.android.support.test.espresso:espresso-intents:2.2.1") {
        exclude group: 'com.android.support', module: 'support-annotations'
    }

    compile 'com.google.firebase:firebase-core:9.0.0'
    compile 'com.google.firebase:firebase-config:9.0.0'
}

apply plugin: 'com.google.gms.google-services'

is plugin: 'com.google.gms.google-services' are conflicting with one of these libraries that cause the app freeze? please help

@samtstern
Copy link
Contributor

To my knowledge the google-services plugin should not be doing anything that would change the responsiveness of your application. It has two main features:

  1. Convert the google-services.json file into string resources at compile time.
  2. Add a dependency on firebase-core when appropriate, but I see you already have that done manually so it would be a no-op.

Given that you have many other dependencies it's hard for me to make a guess at which one is conflicting with google-services. Could you try looking at this documentation about the plugin and seeing if anything stands out to you?

@tungpg
Copy link

tungpg commented Jun 1, 2016

I just had the same problem with you. Just move back to 2.1.0 version and the problem will be resolved.

classpath 'com.google.gms:google-services:2.1.0'

compile 'com.google.android.gms:play-services:8.4.0'

@thesti2
Copy link

thesti2 commented Jun 4, 2016

Hi,

Do you find the solution to this issue? I also experience the same thing.

@ayrtondumas
Copy link

change this line in the project build.gadle

classpath 'com.google.gms:google-services:3.0.0'
to
classpath 'com.google.gms:google-services:2.1.0'

@thesti2
Copy link

thesti2 commented Jun 6, 2016

Hi,

If I change it to version 2.1, then I get this error when building the project:
Error:Failed to resolve: com.google.android.gms:play-services-measurement:9.0.2

Beside, based on the following link:
https://firebase.google.com/docs/android/setup#add_firebase_to_your_app

it is said to use version 3

@ayrtondumas
Copy link

Yes sorry, I do have the same problem...
Cannot fix it, even with the sample apps
Can you build something now?
Le 6 juin 2016 14:37, "thesti2" notifications@github.com a écrit :

Hi,

If I change it to version 2.1, then I get this error when building the
project:
Error:Failed to resolve:
com.google.android.gms:play-services-measurement:9.0.2

Beside, based on the following link:
https://firebase.google.com/docs/android/setup#add_firebase_to_your_app

it is said to use version 3


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#229 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ANbDES2LZ-48lzi72JfNX78WdtrjNAzGks5qJBSFgaJpZM4InWih
.

@thesti2
Copy link

thesti2 commented Jun 7, 2016

Hi,

I still cannot fix this. This seems to happen if I open and close the application a few times in a short interval. But if I open the application again after a few hours interval, the issue does not raise.

I can still build this since I restore the version to 3. But I haven't uploaded this to production.

@michgauz
Copy link

michgauz commented Jun 7, 2016

I have exactly the same problem.

@samtstern
Copy link
Contributor

@michgauz @thesti2 @salismt could one of you capture the output of adb logcat while this is happening? It will likely be too large to post here, so please copy into a pastebin or similar if necessary.

@michgauz
Copy link

michgauz commented Jun 8, 2016

@samtstern That's the point.
I throught something in logcat could help me, but nothing special appear. I will post the output

@thesti2
Copy link

thesti2 commented Jun 10, 2016

Hi,

This is the logcat and anr traces file:
logcat: http://pastebin.com/3KePSWHe
anr traces: http://pastebin.com/C4gYgBg1

@samtstern
Copy link
Contributor

@thesti2 thanks for providing those logs! I will take a look.

@anaszakariyah
Copy link

I got the same problem. The app not responding and there is nothing at all in logcat. I am puzzled.

@tungpg
Copy link

tungpg commented Jun 14, 2016

don't compile bellow line, it includes all of the google services libs. Include only the one you need. I resolve this problem in my app.

compile 'com.google.android.gms:play-services:9.0.2'

@anaszakariyah
Copy link

So I just have to avoid compile play service:9.0.2? wont it affect the app? will it continue to work?
isn't this issue raised because we want to add play service in the first place? or is there alternative?

@tungpg
Copy link

tungpg commented Jun 14, 2016

I mean that you should compile the play service's child library separately.
For example, I want to use the following library then I added then seperately, not the play service one.

// Google Play Services
    compile 'com.google.android.gms:play-services-location:9.0.2'
    compile 'com.google.android.gms:play-services-analytics:9.0.2'
    compile 'com.google.android.gms:play-services-maps:9.0.2'
    compile 'com.google.android.gms:play-services-ads:9.0.2'
    compile 'com.google.android.gms:play-services-identity:9.0.2'
    compile 'com.google.android.gms:play-services-gcm:9.0.2'
    compile 'com.google.android.gms:play-services-auth:9.0.2'

You can find a full list here:
https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project

@samtstern
Copy link
Contributor

@ALL I am trying to reproduce this issue, I have not been able to replicate it yet.

@tungpg has a very good point about never using compile "com.google.android.gms:play-services:x.y.z" when you can avoid it. This is a more general piece of advice, but going to the "split libraries" method will reduce your APK size, dex method count, and generally result in a better application.

For those of you seeing this issue: are you deploying your app on devices that do not have Google Play Services or distributing your app through channels other than the Play Store?

@aitorMarrero
Copy link

I have the same problem, and i need the 3.0 version for use FCM so i cant downgrade to 2.1

@geraldokandonga
Copy link

I am also having the same problem with the google play services v9.0.2, any help guys

@kroikie
Copy link
Contributor

kroikie commented Jul 15, 2016

@gkfillipus does this issue still occur with 9.2.1?

@geraldokandonga
Copy link

@kroikie Yes currently i am even using 9.2.2

@blazsolar
Copy link

Moving apply plugin: 'com.google.gms.google-services' at the end of build.gradle file resolved the issue for me as metioned in plugin docs

@sporteman
Copy link

Hi,
Try update your build .gradle

buildscript {
    repositories {
        jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.2'
    classpath 'com.google.gms:google-services:3.0.0'
    }
}

@TheCroid
Copy link

TheCroid commented Aug 9, 2016

Solution was to put "apply plugin: 'com.google.gms.google-services'" to the end of the build.gradle
and compile 'com.google.firebase:firebase-messaging:9.x.x''" top of dependencies

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-messaging:9.x.x'
}
apply plugin: 'com.google.gms.google-services'

@Hiyam
Copy link

Hiyam commented Aug 24, 2017

Hello, I am still having this issue know that:

  • I have included the google-services.json and added it in the correct place
  • classpath 'com.android.gms:google-services:3.1.0'
  • compile 'com.google.firebase:firebase-core:11.2.0'
  • I have put apply plugin: 'com.google.gms.google-services'

I am getting the following error:
Error:Could not find com.android.gms:google-services:3.1.0.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/gms/google-services/3.1.0/google-services-3.1.0.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/gms/google-services/3.1.0/google-services-3.1.0.jar
https://jcenter.bintray.com/com/android/gms/google-services/3.1.0/google-services-3.1.0.pom
https://jcenter.bintray.com/com/android/gms/google-services/3.1.0/google-services-3.1.0.jar
Required by:
project :

please is this issue solved, I need the answer very soon

@geraldokandonga
Copy link

Hi @Hiyam

Your error is because you are using this 'com.android.gms:google-services:3.1.0' Instead of this classpath 'com.google.gms:google-services:3.0.0'

Change
'com.android.gms:google-services:3.1.0'

To
classpath 'com.google.gms:google-services:3.0.0'

It could solve your problem

@shreyaagrawal0809
Copy link

hello
in my app
if i am clicking on the google sign in button
then
i am getting the option to choose the account i have to sign in with
but after clicking the desired option
it gets load for sometime and then nothing happens
i remain on the same activity
can anyone solve my issue
it is very important please

@KING19933
Copy link

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello World!"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

please help me out

@kapilSoni101
Copy link

@geraldokandonga sir i have tried but i got another error:

Could not find method lasspath() for arguments [com.google.gms:google-services:3.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests