Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android app does not connect to Firebase

I'm developing android app using Firebase GMS service.
I tried to follow their tutorials, i made project as they said, downloaded the json files.

But when I tried to connect my app to Firebase. They show me the error

Could not parse the Android Application Module`s Gradle config. Resolve gardle build issuse and/or resync.

enter image description here

However I think my grade scripts are perfect ( I'll write them bottom of the page)

enter image description here

This is my grade build console

Executing tasks: [:app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources]  Configuration on demand is an incubating feature. WARNING: WARNING: Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android.          In case of problem, please repackage it with jarjar to change the class packages WARNING: WARNING: Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android.          In case of problem, please repackage it with jarjar to change the class packages WARNING: WARNING: Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android.          In case of problem, please repackage it with jarjar to change the class packages WARNING: WARNING: Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android.          In case of problem, please repackage it with jarjar to change the class packages WARNING: WARNING: Dependency org.json:json:20090211 is ignored for release as it may be conflicting with the internal version provided by Android.          In case of problem, please repackage it with jarjar to change the class packages WARNING: WARNING: Dependency org.json:json:20090211 is ignored for release as it may be conflicting with the internal version provided by Android.          In case of problem, please repackage it with jarjar to change the class packages WARNING: WARNING: Dependency org.json:json:20090211 is ignored for release as it may be conflicting with the internal version provided by Android.          In case of problem, please repackage it with jarjar to change the class packages WARNING: WARNING: Dependency org.json:json:20090211 is ignored for release as it may be conflicting with the internal version provided by Android.          In case of problem, please repackage it with jarjar to change the class packages Incremental java compilation is an incubating feature. :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2400Library UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72400Library UP-TO-DATE :app:prepareComAndroidSupportMediarouterV72400Library UP-TO-DATE :app:prepareComAndroidSupportPaletteV72400Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42400Library UP-TO-DATE :app:prepareComAndroidSupportSupportVectorDrawable2400Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServices980Library :app:prepareComGoogleAndroidGmsPlayServicesAds980Library :app:prepareComGoogleAndroidGmsPlayServicesAdsLite980Library :app:prepareComGoogleAndroidGmsPlayServicesAnalytics980Library :app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl980Library :app:prepareComGoogleAndroidGmsPlayServicesAppindexing980Library :app:prepareComGoogleAndroidGmsPlayServicesAppinvite980Library :app:prepareComGoogleAndroidGmsPlayServicesAuth980Library :app:prepareComGoogleAndroidGmsPlayServicesAuthBase980Library :app:prepareComGoogleAndroidGmsPlayServicesAwareness980Library :app:prepareComGoogleAndroidGmsPlayServicesBase980Library :app:prepareComGoogleAndroidGmsPlayServicesBasement980Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesCast980Library :app:prepareComGoogleAndroidGmsPlayServicesCastFramework980Library :app:prepareComGoogleAndroidGmsPlayServicesClearcut980Library :app:prepareComGoogleAndroidGmsPlayServicesDrive980Library :app:prepareComGoogleAndroidGmsPlayServicesFitness980Library :app:prepareComGoogleAndroidGmsPlayServicesGames980Library :app:prepareComGoogleAndroidGmsPlayServicesGass980Library :app:prepareComGoogleAndroidGmsPlayServicesGcm980Library :app:prepareComGoogleAndroidGmsPlayServicesIdentity980Library :app:prepareComGoogleAndroidGmsPlayServicesIid980Library :app:prepareComGoogleAndroidGmsPlayServicesInstantapps980Library :app:prepareComGoogleAndroidGmsPlayServicesLocation980Library :app:prepareComGoogleAndroidGmsPlayServicesMaps980Library :app:prepareComGoogleAndroidGmsPlayServicesNearby980Library :app:prepareComGoogleAndroidGmsPlayServicesPanorama980Library :app:prepareComGoogleAndroidGmsPlayServicesPlaces980Library :app:prepareComGoogleAndroidGmsPlayServicesPlus980Library :app:prepareComGoogleAndroidGmsPlayServicesSafetynet980Library :app:prepareComGoogleAndroidGmsPlayServicesTagmanager980Library :app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi980Library :app:prepareComGoogleAndroidGmsPlayServicesTasks980Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesVision980Library :app:prepareComGoogleAndroidGmsPlayServicesWallet980Library :app:prepareComGoogleAndroidGmsPlayServicesWearable980Library :app:prepareComGoogleFirebaseFirebaseAnalytics980Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseAnalyticsImpl980Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseAuth980Library :app:prepareComGoogleFirebaseFirebaseAuthCommon980Library :app:prepareComGoogleFirebaseFirebaseAuthModule980Library :app:prepareComGoogleFirebaseFirebaseCommon980Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseConfig980Library :app:prepareComGoogleFirebaseFirebaseCore980Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseCrash980Library :app:prepareComGoogleFirebaseFirebaseDatabase980Library :app:prepareComGoogleFirebaseFirebaseDatabaseConnection980Library :app:prepareComGoogleFirebaseFirebaseIid980Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseMessaging980Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseStorage980Library :app:prepareComGoogleFirebaseFirebaseStorageCommon980Library :app:prepareComTsengvnTypekit100Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:processDebugGoogleServices Parsing json file: C:\Users\AJH322\AndroidStudioProjects\hanyang\app\src\debug\google-services.json :app:generateDebugResources :app:mergeDebugResources :app:processDebugManifest :app:processDebugResources :app:generateDebugSources :app:mockableAndroidJar UP-TO-DATE :app:preDebugUnitTestBuild UP-TO-DATE :app:prepareDebugUnitTestDependencies :app:preDebugAndroidTestBuild UP-TO-DATE :app:prepareDebugAndroidTestDependencies :app:compileDebugAndroidTestAidl UP-TO-DATE :app:processDebugAndroidTestManifest :app:compileDebugAndroidTestRenderscript UP-TO-DATE :app:generateDebugAndroidTestBuildConfig UP-TO-DATE :app:generateDebugAndroidTestResValues UP-TO-DATE :app:generateDebugAndroidTestResources UP-TO-DATE :app:mergeDebugAndroidTestResources :app:processDebugAndroidTestResources :app:generateDebugAndroidTestSources  BUILD SUCCESSFUL  Total time: 3 mins 14.678 secs 

and this is my gradle script (module)

apply plugin: 'com.android.application'  android {     compileSdkVersion 23     buildToolsVersion "24.0.0"     defaultConfig {         applicationId "com.example.ajh322.hanyang"         minSdkVersion 15         targetSdkVersion 23         versionCode 1         versionName "1.0"         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"     }     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  dependencies {     compile fileTree(include: ['*.jar'], dir: 'libs')     compile 'com.android.support:appcompat-v7:23.4.0'     compile 'com.google.android.gms:play-services:9.8.0'     compile 'com.tsengvn:Typekit:1.0.0'     compile 'com.squareup.okhttp3:okhttp:3.4.2'     compile 'com.github.nkzawa:socket.io-client:0.3.0'     testCompile 'junit:junit:4.12' } apply plugin: 'com.google.gms.google-services' 

project gradle apply plugin: 'com.android.application'

android {     compileSdkVersion 23     buildToolsVersion "24.0.0"     defaultConfig {         applicationId "com.example.ajh322.hanyang"         minSdkVersion 15         targetSdkVersion 23         versionCode 1         versionName "1.0"         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"     }     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  dependencies {     compile fileTree(include: ['*.jar'], dir: 'libs')     compile 'com.android.support:appcompat-v7:23.4.0'     compile 'com.google.android.gms:play-services:9.8.0'     compile 'com.tsengvn:Typekit:1.0.0'     compile 'com.squareup.okhttp3:okhttp:3.4.2'     compile 'com.github.nkzawa:socket.io-client:0.3.0'     testCompile 'junit:junit:4.12' } apply plugin: 'com.google.gms.google-services' 

does anybody know how can I connect to Firebase with my app?
please save my life... thanks



+ i updated my sdk tools as people said
still not works.
enter image description here

like image 572
AJH Avatar asked Nov 13 '16 18:11

AJH


People also ask

Why my app is not connecting to Firebase?

Please refresh the page and try linking your app again. If you still have issues: Confirm that you're using the same email address for both AdMob and Firebase. Confirm that the project you're linking to hasn't been deleted.

How do I connect my Android app to Firebase?

Open the Firebase Assistant: Tools > Firebase. In the Assistant pane, choose a Firebase product to add to your app. Expand its section, then click the tutorial link (for example, Analytics > Log an Analytics event). Click Connect to Firebase to connect your Android project with Firebase.

Why is my Android Studio not connecting to Firebase?

Just sign out your gmail account from Android Studio and then re-sign in again. After this, try again connecting to the firebase. It should connect!

How can I tell if Firebase is connected Android?

If you want to know if the client is connected to the server before calling setValue() , you can attach a listener to . info/connected .


2 Answers

I had the exact same issue. I built successfully but got the same message when hitting the 'Connect to Firebase' button via Assistant.

It turned out that I had a warning that I had to fix to get it to work.

"Configuration on demand is an incubating feature. 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"

I just had to replace my 'compile's with 'api' and then it worked. I'd suggest looking into fixing warnings if you have any even though your build is successful.

like image 163
Jerry Sha Avatar answered Oct 01 '22 03:10

Jerry Sha


I tried a lot of ways, but the simplest way is updated com.google.gms:google-services from 3.1.1 to 3.2.0

like image 41
Doan Bui Avatar answered Oct 01 '22 03:10

Doan Bui