I am trying to upgrade my google play services dependencies to 8.4.0 by following the example Google gives here, but I am getting the following error (\'com.example.examplea
Simpal an easy In my case it solved by as below
Make sure your pakage name in mainifests file same as your gradle's applicationId.
Please verify build.gradle.
defaultConfig {
applicationId "<packagename>"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
Verify the package name.It can also cause error.
I found success using this configuration:
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha3'
//or use
//classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
and
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
using 8.40 Google Play services. Alpha5 & Alpha6 gave the same 2.8 error you had, regardless of the distributionUrl being 2.10
Add this in project gradle file
classpath 'com.google.gms:google-services:3.0.0'
Solved the problem of getting an exception
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process Make sure to call FirebaseApp.initializeApp(Context) first.
in FirebaseInstanceId.getInstance().getToken()
Check that package_name exactly matches applicationId 1) build.gradle
defaultConfig {
applicationId "build.gradle.exactly.matches.json"
...
}
should exactly match 2) google-services.json
{
"client_info": {
"mobilesdk_app_id": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
"android_client_info": {
"package_name": "build.gradle.exactly.matches.json"
....
This exact same error happened to me only when I tried to build my debug build type. The way I solved it was to change my google-services.json
for my debug build type.
My original field had a field called client_id
and the value was android:com.example.exampleapp
, and I just deleted the android:
prefix and leave as com.example.exampleapp
and after that my gradle build was successful.
Hope it helps!
EDIT
I've just added back the android:
prefix in my google-services.json
and it continued to work correctly. Not sure what happened exactly but I was able to solve my problem with the solution mentioned above.