I recently needed to use Google GCM in my project. From its website it is said:
Firebase Cloud Messaging (FCM) is the new version of GCM. It inherits
the reliable and scalable GCM infrastructure, plus new features! See
the FAQ to learn more. If you are integrating messaging in a new app,
start with FCM. GCM users are strongly recommended to upgrade to FCM,
in order to benefit from new FCM features today and in the future.
In order to setup a new Firebase application, I've followed the instructions provided at the official website and did the following:
Created a new Firebase app in the web console and got my json from there - after providing the correct package of my app;
At the top level project's gradle file, I've added classpath 'com.google.gms:google-services:3.0.0' in the dependency section;
At my module's gradle file, I've added: compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0' and in the last line of it, I've added: apply plugin: 'com.google.gms.google-services';
Full Gradle files are provided below:
Top level gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module's gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "br.com.gogame"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
...
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
...
}
apply plugin: 'com.google.gms.google-services'
When I start my app I get this stacktrace:
05-23 14:04:55.109 13368-13368/br.com.gogame I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzqq$zzd>
05-23 14:04:55.109 13368-13368/br.com.gogame I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzqq$zzd>
05-23 14:04:55.110 13368-13368/br.com.gogame I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzqq$zzc>
05-23 14:04:55.110 13368-13368/br.com.gogame I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzqq$zzc>
05-23 14:04:55.126 13368-13368/br.com.gogame E/FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5174)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: java.lang.NoSuchMethodError: No static method zzy(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzx; or its super classes (declaration of 'com.google.android.gms.common.internal.zzx' appears in /data/app/br.com.gogame-2/base.apk:classes26.dex)
at com.google.android.gms.measurement.internal.zzt.zzaU(Unknown Source)
at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5174)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
05-23 14:04:55.131 13368-13368/br.com.gogame I/FirebaseInitProvider: FirebaseApp initialization successful
05-23 14:04:55.133 13368-13368/br.com.gogame E/AndroidRuntime: FATAL EXCEPTION: main
Process: br.com.gogame, PID: 13368
java.lang.NoSuchMethodError: No static method zzy(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzx; or its super classes (declaration of 'com.google.android.gms.common.internal.zzx' appears in /data/app/br.com.gogame-2/base.apk:classes26.dex)
at com.google.android.gms.measurement.internal.zzt.zzaU(Unknown Source)
at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at android.app.ActivityThread.installProvider(ActivityThread.java:5174)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Any help solving this problem will be very appreciated!
Regards
Well, after struggle a lot I found what was causing my problem. Basically I had two libraries modules - that happened to be of my own - each one of them importing different versions of com.android.support:appcompat-v7.* and google play services. Made all of them import the same version and problem is gone.
I met the same error, solved by upgrade firebase-core:
dependencies {
compile 'com.google.firebase:firebase-core:9.0.2'
}
Care to see that all the dependencies should have same version
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
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:25.2.0'
implementation 'com.android.support:design:25.2.0'
implementation 'com.android.support:support-v4:25.2.0'
implementation 'com.google.firebase:firebase-auth:10.0.1'
implementation 'com.android.support:cardview-v7:25.2.0'
implementation 'com.google.firebase:firebase-database:10.0.1'
testCompile 'junit:junit:4.12'
}
I faced the Same Issue, but after some r & d and I came to known the problem was in Gradle i.e,
compile "com.android.support:support-v4:+"
then I just removed the + and replaced actual version ie,
compile "com.android.support:support-v4:23.1.0"
then it started working
For me a completely unrelated import caused this error
compile 'com.aurelhubert:ahbottomnavigation:1.3.3'
When I removed it everything was fine
In my case, the problem occurs because i had put "apply plugin: 'com.google.gms.google-services'" inside the dependencies of the modules build.grandle insteand of putting it at the end of the file.
I had the same issue, fixed by upgrading to play-services-auth:10.0.1:
dependencies {
......
//implementation 'com.google.android.gms:play-services-auth:9.0.0'
implementation 'com.google.android.gms:play-services-auth:10.0.1'
....
}
You can check the dependencies with gradle command
./gradlew app:dependencies
As Edgar said ensure that all the dependency libraries has same version.
If not then you can exclude that dependency using
compile('your dependency') {
exclude group: 'lib to be removed'
}
And add that dependency yourself.
add compile 'com.google.android.gms:play-services:9.0.0' into your app level build.gradle file
Me, after struggle all night because my dependencies' version are the same. After adding Firebase Analytics, when I edited the code and run to my device my app crashed with Rejecting re-init on previously-failed class com.google.android.gms... I have to clean project and run again, then it worked fine but will be crashed again if I edit the code.
My problem was caused by "useProguard false" from following this guide https://developer.android.com/studio/build/shrink-code.html
debug {
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
but I disabled Instant Run so remove "useProguard false" fixed my problem.
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
More complete answer for newbies. #Edgar is correct, Thanks!
Error: "Firebase API initialization failure" can be found in logcat of Android Monitor is due to incompatible library version. And it can be any libraries that you compile your app with in Project perspective: go to: Your-app-directory/app/build.gradle
In my case I have to match these 2 module version and that solved this error message:
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-appindexing:16.0.1'
I attached here the screen shot so you can see all of it.
In My case i forgot to add this with in App Level build
implementation 'com.google.firebase:firebase-messaging:9.6.0'
So i got the FireBase firebase-api-initialization-failure
Related
I am getting this error:
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/util/Function;
Here is the full output:
2018-11-09 18:33:22.546 24224-24224/com.test.notes.notes E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.test.notes.notes, PID: 24224
java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
at com.google.android.gms.internal.firebase-firestore.zzkj.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:6274)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/util/Function;
at com.google.android.gms.internal.firebase-firestore.zzfu.zzd(Unknown Source)
at com.google.android.gms.internal.firebase-firestore.zzeg.<init>(Unknown Source)
at com.google.android.gms.internal.firebase-firestore.zzcj.zza(Unknown Source)
at com.google.android.gms.internal.firebase-firestore.zzcl.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at com.google.android.gms.internal.firebase-firestore.zzkg$zza.run(Unknown Source)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.util.Function" on path: DexPathList[[zip file "/data/app/com.test.notes.notes-1/base.apk", zip file "/data/app/com.test.notes.notes-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.test.notes.notes-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.test.notes.notes-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.test.notes.notes-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.test.notes.notes-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.test.notes.notes-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.test.notes.notes-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.test.notes.notes-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.test.notes.notes-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.test.notes.notes-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.test.notes.notes-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.test.notes.notes-1/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.android.gms.internal.firebase-firestore.zzfu.zzd(Unknown Source)
at com.google.android.gms.internal.firebase-firestore.zzeg.<init>(Unknown Source)
at com.google.android.gms.internal.firebase-firestore.zzcj.zza(Unknown Source)
at com.google.android.gms.internal.firebase-firestore.zzcl.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at com.google.android.gms.internal.firebase-firestore.zzkg$zza.run(Unknown Source)
at java.lang.Thread.run(Thread.java:761)
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.test.notes.notes-1/split_lib_slice_7_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:367)
at dalvik.system.DexFile.<init>(DexFile.java:112)
at dalvik.system.DexFile.<init>(DexFile.java:77)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:359)
at dalvik.system.DexPathList.makeElements(DexPathList.java:323)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:263)
at dalvik.system.DexPathList.<init>(DexPathList.java:126)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:58)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:541)
2018-11-09 18:33:22.546 24224-24224/com.test.notes.notes E/AndroidRuntime: at android.app.LoadedApk.getClassLoader(LoadedApk.java:574)
at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:1900)
at android.app.LoadedApk.getResources(LoadedApk.java:787)
at android.app.ContextImpl.<init>(ContextImpl.java:2038)
at android.app.ContextImpl.createAppContext(ContextImpl.java:1983)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5439)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1576)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:6274)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
And I think my build.gradle is needed so here is my build.gradle(Project: test):
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.test.notes.notes"
minSdkVersion 16
targetSdkVersion 27
versionCode 17
versionName "5.1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
aaptOptions {
cruncherEnabled = false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.android.support:support-vector-drawable:27.0.2'
implementation 'com.google.firebase:firebase-firestore:15.0.0'
implementation 'com.firebaseui:firebase-ui-firestore:3.1.1'
api 'com.joooonho:selectableroundedimageview:1.0.1'
api 'com.github.bumptech.glide:glide:3.7.0'
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'
api 'com.google.firebase:firebase-core:16.0.5'
api 'com.google.firebase:firebase-firestore:15.0.0'
api 'com.google.firebase:firebase-storage:16.0.4'
api 'com.google.firebase:firebase-auth:16.0.5'
api 'com.crashlytics.sdk.android:crashlytics:2.9.5'
}
apply plugin: 'com.google.gms.google-services'
With that error, the app crashes.
I think there could be anything wrong with the firebase SDK, but can't figure it out?
Please help me to fix this. I didn't find a way to fix it, for a long time.:(
EDIT:
After updated everything to the newest version and added:
multiDexEnabled true
...everything works fine. But now I have the Problem, why I downgraded the versions finally. Please have a look at my question: I don't get a response:
Updating code after firebase 16.0.+ update
When I could fix that everything would be fine.
I see a whole mess of problems in your build.gradle.
The first category of issues is that most of your dependencies are pretty outdated.
The Android API 27 support libraries are on 27.1.1, not 27.0.2.
firebase-firestore is on 17.1.2, not 15.0.0.
firebase-ui-firestore is on 4.2.1, not 2.1.1.
glide is on 4.8.0, not 3.7.0.
Dependency versions should be up-to-date in general, but absolutely must be up-to-date if they're from Google. Otherwise you run into exactly the type of error you have.
The second problem is that you implement firebase-firestore twice, once with implementation and again with api. Remove one or the other.
A handy tip: if a dependency is highlighted in yellow, that means it's outdated! Click the text, hit Alt+Enter and choose the option to update it to the latest version.
I'm having trouble using Firebase authentication in conjunction with FirebaseUI. When I run my application the following problem appears: "Default FirebaseApp is not initialized in this process. Make sure to call FirebaseApp.initializeApp (Context) first."
In my app / build.gradle I have the dependencies:
implementation 'com.google.firebase: firebase-core: 16.0.1'
implementation 'com.google.firebase: firebase-auth: 16.0.1'
implementation 'com.google.firebase: firebase-database: 16.0.1'
implementation 'com.firebaseui: firebase-ui-auth: 4.1.0'
and the "apply plugin: 'com.google.gms.google-services" at the end.
in my module / build.gradle I have dependency:
classpath 'com.google.gms: google-services: 4.1.0'
classpath 'com.android.tools.build:gradle:3.3.0-alpha07'
I have already exported my googleservices.json to the "app" folder. I was left with no options and the problem continues. Any suggestions?
Logcat:
--------- beginning of crash
08-31 19:40:12.718 2865-2865/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: br.com.luccas.buscaperto, PID: 2865
java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.luccas.buscaperto/br.com.luccas.buscaperto.MainActivity}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process br.com.luccas.buscaperto. Make sure to call FirebaseApp.initializeApp(Context) first.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process br.com.luccas.buscaperto. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(SourceFile:218)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at br.com.luccas.buscaperto.MainActivity.instantiateUser(MainActivity.java:89)
at br.com.luccas.buscaperto.MainActivity.onCreate(MainActivity.java:64)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
my top level gradle:
buildscript {
ext {
release = [
versionName: "6.1.0-rc01",
versionCode: 6100
]
setup = [
compileSdk: 28,
buildTools: "28.0.2",
minSdk : 14,
targetSdk : 28
]
versions = [
androidX: '1.0.0-rc01'
]
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha07'
classpath 'com.google.gms:google-services:4.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
my app level gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "br.com.luccas.buscaperto"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '28.0.2'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.legacy:legacy-support-v4:${versions.androidX}"
implementation "androidx.appcompat:appcompat:${versions.androidX}"
implementation "androidx.constraintlayout:constraintlayout:${versions.androidX}"
implementation "androidx.recyclerview:recyclerview:${versions.androidX}"
implementation "androidx.annotation:annotation:${versions.androidX}"
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.mikepenz:materialdrawer:6.1.0-rc01'
implementation "com.google.android.material:material:${versions.androidX}"
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
apply plugin: 'com.google.gms.google-services'
Please upgrade your project level gms dependencies, I upgraded to 4.2.0 and it worked
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
I had same issue and the issue was with google-services.json that was not in proper format and some how, google-services.json had following in the file
COMMENT start
clone the project and in firefox create a database and give the package name as .....
Try to do like so:
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0
And change this:
classpath 'com.android.tools.build:gradle:3.3.0-alpha07'
to
classpath 'com.android.tools.build:gradle:3.1.4'
you need to update your google_services.json file. Download it from firebase and replace with the existing one. In json file there is a configuration which automatically merged the content provider which intitalizes your Firebase for the app with your manifest by default on building with gradle. But your current json file is missing that configuration. So you need to replace or you need to call static FirebaseApp(Context) method to solve this problem.Read Here
Add this in your app launcher onCreate method as
...... onCreate(.....)
{
FirebaseApp.initializeApp(this);
..........
}
It works by downgradind to:
classpath 'com.android.tools.build:gradle:3.2.0-alpha14'
I had same issue in my app,
but according to https://issuetracker.google.com/issues/112716914 this issue tracker
I have updated to version classpath 'com.google.gms:google-services:4.2.0' and issue got resolved.
Edit your dependencies in build.gradle Project level:
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
Oncreate method add this:
FirebaseApp.initializeApp(this);
Before any changes my gradle looked like this:
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.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.firebaseui:firebase-ui-auth:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
and
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and everything was working fine. Then I updated all of the com/google... dependencies to 10.2.0 version and firebaseui to 1.2.0 as the table here says https://github.com/firebase/FirebaseUI-Android#compatibility-with-firebase--google-play-services-libraries
Then I got some errors on mFirebaseAuth = FirebaseAuth.getInstance() line (sorry but can't remember what exactly) so I changed back all of the versions to 10.0.1 and 1.0.1 and I'm still getting error and my application crashes on start (this error is different than the previous one).
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mnm135.emil.showsmanager, PID: 3837
java.lang.NoSuchMethodError: No static method zzdz(Ljava/lang/String;)Z in class Lcom/google/android/gms/common/util/zzw; or its super classes (declaration of 'com.google.android.gms.common.util.zzw' appears in /data/app/com.mnm135.emil.showsmanager-1/base.apk)
at com.google.firebase.FirebaseOptions.<init>(Unknown Source)
at com.google.firebase.FirebaseOptions.fromResource(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5811)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
I tried Invalidate caches/restart, clean and rerun. Even rebooting my pc. Nothing seems to work.
Any ideas?
Edit:
I tried aaroncio's solution, removed apply plugin: 'com.google.gms.google-services' and I'm getting different error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mnm135.emil.showsmanager, PID: 5157
java.lang.NoSuchMethodError: No static method zzzq()Ljava/lang/String; in class Lcom/google/android/gms/common/util/zzu; or its super classes (declaration of 'com.google.android.gms.common.util.zzu' appears in /data/app/com.mnm135.emil.showsmanager-2/base.apk)
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at com.mnm135.emil.showsmanager.base.LoginActivity.onCreate(LoginActivity.java:34)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Line mentioned in comment is mFirebaseAuth = FirebaseAuth.getInstance();
I solved it removing the line about firebase-authentication in the build-gradle file:
compile 'com.google.firebase:firebase-auth:10.2.1'
I removed the imports about authentication also, I was just making some experiments with firebase auth so its not important in this case, but to others may not be ideal solution.
It looks like something changed with the last version of Google Services, I had a similar problem and solved it deleting the following line in gradle:
apply plugin: 'com.google.gms.google-services'
Hi I'm learning to use Firebase from an Udacity Course.
I got this error when I ran my app and have no clue about it.
11-23 16:48:34.995 3947-3947/com.google.firebase.udacity.friendlychat
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.google.firebase.udacity.friendlychat, PID: 3841
java.lang.NoSuchMethodError: No virtual method zzait()Ljava/util/ArrayList;
in class Lcom/google/android/gms/auth/api/signin/GoogleSignInOptions;
or its super classes (declaration of 'com.google.android.gms.auth.api.signin.GoogleSignInOptions' appears in /data/data/com.google.firebase.udacity.friendlychat/files/.jrebel/load-dexes/bundle12/libraries24.zip)
at com.google.android.gms.auth.api.Auth$3.zza(Unknown Source)
at com.google.android.gms.auth.api.Auth$3.zzp(Unknown Source)
at com.google.android.gms.common.api.GoogleApiClient$Builder.addApi(Unknown Source)
at com.firebase.ui.auth.util.CredentialsAPI.initGoogleApiClient(CredentialsAPI.java:147)
at com.firebase.ui.auth.util.CredentialsAPI.<init>(CredentialsAPI.java:65)
at com.firebase.ui.auth.ui.ChooseAccountActivity.onCreate(ChooseAccountActivity.java:102)
at android.app.Activity.performCreate(Activity.java:6100)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112) at com.zeroturnaround.jrebel.android.agent.JRebelInstrumentation.callActivityOnCreate(SourceFile:93)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2468)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2601)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5637)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
11-23 16:48:35.176 3947-3975/com.google.firebase.udacity.friendlychatE/GED: Failed to get GED Log Buf, err(0)
Can anyone help me?
UPDATE build.gradle
apply plugin: 'com.android.application'
repositories {
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
// Firebase
compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.firebaseui:firebase-ui-database:1.0.0'
// FirebaseUI Auth only
compile 'com.firebaseui:firebase-ui-auth:1.0.0'
// FirebaseUI Storage only
compile 'com.firebaseui:firebase-ui-storage:1.0.0'
// Single target that includes all FirebaseUI libraries above
compile 'com.firebaseui:firebase-ui:1.0.0'
// Firebase Auth
compile 'com.google.firebase:firebase-auth:10.0.0'
}
apply plugin: 'com.google.gms.google-services'
Matching the versions resolves this.
In Compatibility with Firebase / Google Play Services Libraries, it matches
FirebaseUI Version Firebase/Play Services Version
1.0.0 9.8.0
So if dependencies are changed to
compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.google.firebase:firebase-auth:9.8.0'
compile 'com.firebaseui:firebase-ui-auth:1.0.0'
instead of
compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.google.firebase:firebase-auth:10.0.0'
compile 'com.firebaseui:firebase-ui-auth:1.0.0'
which is the latest available firebase version for firebaseUI version, the app works fine
This is most likely do to a version incompatibility between Firebase, and FirebaseUI. I ran into the same issue, and spent 30-45 min trying to figure it out. Ultimately what I did in order to keep going with the "Firebase in a Weekend" tutorial was:
git checkout 1.04-firebase-auth-firebaseui-signin
This will switch to the branch at this point in the tutorial. It works fine after doing so.
Maybe not the ideal answer as to what the problem is, but will get you going again with the course.
You just need to add :
compile 'com.google.android.gms:play-services-auth:x.x.x'(find the right version here). They missed to say that you also need to add play-services-auth dependency for google authentication to work.
My Android application started crashing today when generating a token for Google Cloud Messaging (GCM). This happens on multiple devices and version of Android. I think it may have to do with the new Firebase features announced by Google yesterday at Google IO.
I wasn't working around the code related to GCM when this started happening so it was unexpected. If I uninstall Google Play Services updates from Android system settings, the app no longer crashes. As soon as I re-install the latest, the app starts crashing again every time.
FATAL EXCEPTION: IntentService[MyGCMRegistrationIntentService]
Process: <my process>, PID: 26036
java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
at com.google.android.gms.iid.zzd.zzeb(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
at <package>.MyGCMRegistrationIntentService.onHandleIntent(MyGCMRegistrationIntentService.java:<line number>);
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
Here is my registration service:
public class MyGCMRegistrationIntentService extends IntentService
{
public static final String KEY_GCM_TOKEN = "gcm_token";
public static final String KEY_GCM_INSTANCE_ID = "gcm_instance_id";
private static final String NAME = MyGCMRegistrationIntentService.class.getSimpleName();
public MyGCMRegistrationIntentService()
{
super(NAME);
}
#Override
protected void onHandleIntent(final Intent intent)
{
try
{
final InstanceID instanceId = InstanceID.getInstance(this);
final String token = instanceId.getToken(getGCMSenderID(), GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
final String instanceIdId = instanceId.getId();
sendTokenToMyServer(token, instanceIdId);
}
catch (final IOException e)
{
Timber.e(e, "Error getting GCM token.");
}
}
}
Top-level Gradle build file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'de.felixschulze.gradle:gradle-hockeyapp-plugin:3.3'
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:2.1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
}
}
App-level Gradle build dependencies dealing with Google:
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:support-annotations:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:support-v13:23.3.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
...(and then the rest of my dependecies)
}
Library dependencies dealing with Google (I know this is all messy and some things are redundant, sorry):
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:support-v13:23.3.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
...(and then the rest of my dependecies)
}
I thought maybe upgrading the versions would help. Here is what I upgraded:
com.google.gms:google-services:2.1.0 -> com.google.gms:google-services:3.0.0
com.google.android.gms:play-services-XXX:8.4.0' -> com.google.android.gms:play-services-XXX:9.0.0
The application still crashes, but in a different way. First it logs the following, but does not crash.
Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1696)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1671)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4999)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
at com.google.firebase.iid.zzg.zzeC(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzd.zzb(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1696)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1671)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:4999)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
After I move around in the app which triggers the GCM registration, I get the same stack as before along with this line before crashing:
E/FA: Task exception on worker thread: java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar): com.google.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
So the issue is that you have dependencies that inlcude old versions of the support library. Check this thread out:
Android UrbanAirship Crash in takeOff
Doing this might help (from the thread):
configurations.all {
resolutionStrategy {
force 'com.android.support:design:23.4.0'
force 'com.android.support:support-v4:23.4.0'
force 'com.android.support:appcompat-v7:23.4.0'
}
}
Try this it will solve
configurations.all {
resolutionStrategy {
force 'com.android.support:design:23.4.0'
force 'com.android.support:support-v4:23.4.0'
force 'com.android.support:appcompat-v7:23.4.0'
}
}
if you still have problem then you can solve it as,
Updated the play-services dependencies in build.gradle
dependencies {
compile 'com.google.android.gms:play-services:9.0.0'}
If any version conflict fix it by adding this in build.gradle (project gradle)
dependencies {
classpath 'com.google.gms:google-services:3.0.0'}
update may 27:
we just released an update (version 9.0.1) to fix the incompatibility I mentioned in my first edit.
Please update your dependencies and let us know if this is still an issue.
Thanks!
original answer May 20:
Version 9.0.0 of Google Play services sdk includes an incompatibility with the support library version 24.x (the version released to support Android-N)
Please check that you are using:
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
}
and not com.android.support:appcompat-v7:24.*
If you already update Android Support Repository, revert it by replacing m2repository folder at sdk path.
First download Older m2repository :
https://dl-ssl.google.com/android/repository/android_m2repository_r31.zip
SDK Path
Replace m2repository folder
Just upate your GCM library, it'll fix your Problem.
compile "com.google.android.gms:play-services-gcm:9.2.0"