FCM - Getting push notification data twice - firebase

I've been struggling with this issue for a long time so I decided to ask you.
I'm developing a chat app and for push notifications I'm using Firebase Functions. I'm getting always the data from onMessageReceived twice. For some people the solution was removing de gcm dependencies and use only the firebase ones but i think is not my case. Anyway I'm showing you all the code:
This is my index.js:
exports.notifications = functions.database.ref('chats/{chatUid}/messages/{pushId}').onWrite( (change, context) => {
var valueObject = change.after.val();
var chatUid = change.after.ref.parent.parent.key;
var data = {
'data' : {
'conversation_id' : chatUid,
'message_key' : change.after.key,
'message_title' : valueObject.title,
'message_body' : valueObject.message,
'userFrom' : valueObject.userFrom.toString()
}
};
const options = {
priority: "high",
timeToLive: 60 * 60 * 24
};
return admin.messaging().sendToTopic(chatUid, data, options)
});
My gradle settings:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "xxx"
minSdkVersion 21
targetSdkVersion 27
versionCode xxx
versionName "x.x.x"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '27.0.3'
productFlavors {
}
}
ext {
support_version = '27.1.1'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.android.support:design:$support_version"
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:customtabs:$support_version"
implementation "com.android.support:support-v4:$support_version"
implementation "com.android.support:cardview-v7:$support_version"
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation "com.android.support:percent:$support_version"
implementation "com.android.support:recyclerview-v7:$support_version"
implementation 'com.android.support:support-v4:27.1.1'
testImplementation 'junit:junit:4.12'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation('com.squareup.retrofit2:retrofit:2.3.0') {
exclude module: 'okhttp'
}
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.okhttp3:okhttp:3.9.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.facebook.android:facebook-android-sdk:4.18.0'
implementation 'com.google.firebase:firebase-analytics:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-config:16.0.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.firebaseui:firebase-ui-database:3.3.1'
implementation 'com.firebaseui:firebase-ui-storage:3.3.1'
implementation 'commons-codec:commons-codec:1.11'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'}
Thank you for your time :D

I'm stupid.
It was my fault in android code, nothing to do with firebase functions:
I was using onWrite(index.js) and in my android code I was writting twice in firebase database, one for writing the message_key(push()) and other for setting the properties(setValue()):
finalReference.push().apply {
val map2 = HashMap<String, Any?>()
val dateFormat = SimpleDateFormat(DATE_FORMAT, Locale.getDefault())
dateFormat.timeZone = TimeZone.getTimeZone("UTC")
map2[FB.DATE] = dateFormat.format(Date())
map2[FB.MESSAGE] = entryText.text.toString()
map2[FB.READ] = false
map2[FB.RECEIVED] = false
map2[FB.TITLE] = fbUser.displayName
map2[FB.USER_FROM] = fbUser.uid.toLong()
map2[FB.USER_TO] = conversation_data!!.users_id.find { it != fbUser.uid }?.toLong()
setValue(map2).addOnSuccessListener {
child(FB.RECEIVED).setValue(true)
}
entryText.setText("")
}
So the solution was to change onWrite for onCreate on index.js.
Hope it helps anybody.

Related

Android Studio - Could not parse the Android Application Module's Gradle config

I wish to develop a chat app using firebase. However, I can't Connect to Firebase in the assistant pannel. Instead, it shows this error message
Could not parse the Android Application Module's Gradle config. Resolve gradle build issues and/or resync.
I tried searching up for fix online people suggest to delete jCenter() from gradle but i don't even have this code in my file. I was able to sync my project everything seems to work fine except i couldn't connect to it.
Project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module gradle
plugins {
id 'com.android.application'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}
android {
compileSdk 32
defaultConfig {
applicationId "android.exercise.myExercise"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
manifestPlaceholders = [MAPS_API_KEY: "${properties.getProperty('secret-apiKey')}"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'com.google.android.gms:play-services-maps:18.0.1'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.annotation:annotation:1.3.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'com.google.android.material:material:1.6.0-alpha01'
implementation 'com.github.VishnuSivadasVS:Advanced-HttpURLConnection:1.2'
implementation 'com.google.android.gms:play-services-maps:18.0.2'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// chat sys
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.firebase:firebase-database:19.1.0'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
}
It's a little late, but I can still help. I had the same problem. And I solved the problem
File>Project Specture>Modules
or
Ctrl+Alt+Shift+S >Modules
Compile sdk Version: 32 or latest version
Build Tools Version: 32.0.0 or latest version
then click Apply button
then click OK button
and the problem will be solved.
Sorry for my english, i don't know english.
Add MAVEN in Project gradle:
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // Add this repository
}

Error migrating to new jetpack compose version

I'm trying to update my app to a new compose version but it gave me an error that I don't know how to fix. when I run the error persists in my run. my old project works normally but mine what I want is to change versions follow my error if anyone can help me i would appreciate it a lot
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.quitanda, PID: 10390
java.lang.AbstractMethodError: abstract method "void androidx.lifecycle.DefaultLifecycleObserver.onCreate(androidx.lifecycle.LifecycleOwner)"
at androidx.lifecycle.FullLifecycleObserverAdapter.onStateChanged(FullLifecycleObserverAdapter.java:36)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:196)
at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:808)
at android.view.View.dispatchAttachedToWindow(View.java:18355)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3399)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3406)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3406)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3406)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3406)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1796)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1494)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7288)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
at android.view.Choreographer.doCallbacks(Choreographer.java:761)
at android.view.Choreographer.doFrame(Choreographer.java:696)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6923)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
build.gradle(Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
task clean(type: Delete) {
delete rootProject.buildDir
}
buildscript {
ext {
compose_version = '1.0.0-rc01'
}
}
build.gradle(Module)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
apply plugin:'kotlin-parcelize'
android {
compileSdk 30
defaultConfig {
applicationId "com.example.quitanda"
minSdk 21
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
}
dependencies {
def appcompat_version = "1.3.0"
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-alpha02'
implementation 'androidx.core:core-ktx:1.6.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.0-rc01'
implementation "androidx.appcompat:appcompat:$appcompat_version"
// For loading and tinting drawables on older versions of the platform
implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
// implementation "com.google.accompanist:accompanist-coil:0.7.1"
implementation "io.coil-kt:coil-compose:1.3.0"
implementation "androidx.navigation:navigation-compose:2.4.0-alpha05"
implementation "com.google.accompanist:accompanist-swiperefresh:0.8.0"
implementation "com.google.accompanist:accompanist-pager:0.8.1"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-moshi:2.9.0"
implementation "androidx.paging:paging-compose:1.0.0-alpha08"
}
It is an error with the AGP. Change the minSDKVersion to 24 for now
As described in the documentation:
If you are using Android Studio Bumblebee Canary 4 or AGP 7.1.0-alpha04/7.1.0-alpha05, you may hit the following crash:
java.lang.AbstractMethodError: abstract method "void androidx.lifecycle.DefaultLifecycleObserver.onCreate(androidx.lifecycle.LifecycleOwner)"
To fix, temporarily increase your minSdkVersion to 24+ in your build.gradle file. This issue will be fixed in the next version of Android Studio Bumblebee and AGP 7.1.

Uploading App to Play store, Your app(s) are using an unsafe implementation of the HostnameVerifier

I searched a lot on google and stack overflow but nothing is help full ,i Am getting this error when uploading to playstore , app is working good but still facing this. i checked the code but i never found hostnameverifier in any app file. But i found this word in debugging files can any one help me.
Your app(s) are using an unsafe implementation of the HostnameVerifier interface. You can find more information about how resolve the issue in this Google Help Center article.
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 29
defaultConfig {
applicationId "xxxxxxxxxxxxxx"
minSdkVersion 19
targetSdkVersion 29
versionCode 3
versionName "1.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [onesignal_app_id: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", onesignal_google_project_number: "REMOTE"]
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// Androidx Support Library --------------------------------------------------------------------
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
// Google Material Library ---------------------------------------------------------------------
implementation 'com.google.android.material:material:1.1.0'
// Firebase Library ----------------------------------------------------------------------------
implementation 'com.google.firebase:firebase-auth:19.3.1'
implementation 'com.google.firebase:firebase-core:17.4.0'
implementation 'com.google.firebase:firebase-ads:19.1.0'
implementation 'com.google.firebase:firebase-messaging:20.1.6'
implementation 'com.google.firebase:firebase-analytics:17.4.0'
// Squareup API Library ------------------------------------------------------------------------
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.squareup.retrofit2:retrofit:2.8.1'
implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
// Volley API Library --------------------------------------------------------------------------
implementation 'com.android.volley:volley:1.1.1'
// Google Libraries
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.android.gms:play-services-ads:19.1.0'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
// Facebook SDK Library ------------------------------------------------------------------------
implementation 'com.facebook.shimmer:shimmer:0.5.0'
implementation 'com.facebook.fresco:fresco:2.0.0'
implementation 'com.facebook.android:facebook-login:5.15.3'
// Add the Firebase SDK for Crashlytics. -------------------------------------------------------
implementation 'com.google.firebase:firebase-crashlytics:17.0.0'
// One Signal sdk library ----------------------------------------------------------------------
implementation 'com.onesignal:OneSignal:3.15.3'
// Paytm Payment Getway Dependencies -----------------------------------------------------------
implementation('com.paytm:pgplussdk:1.4.4') {
transitive = true
}
// Paypal Payment Getway Dependencies ----------------------------------------------------------
implementation 'com.braintreepayments.api:braintree:2.22.0'
implementation 'com.braintreepayments.api:drop-in:3.7.1'
// Third Party Dpendencies --------------------------------------------------------------------
implementation 'com.balysv:material-ripple:1.0.2' // ripple effect
implementation 'com.github.bumptech.glide:glide:4.10.0' // image loader
implementation 'de.hdodenhof:circleimageview:2.2.0' // circle image view
implementation 'com.hbb20:ccp:2.3.4' // country code picker
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
apply plugin: 'com.google.gms.google-services'

error "No such property: applicationVariants for class: java.lang.String" when connecting the plugin "com.google.gms.google-services"

I am using the latest version of Android Studio and all plugins. I am trying to connect android app to firebase console. Successfully downloaded google-services.json file and added to module root directory. Added lines "classpath 'com.google.gms: google-services: 4.3.3" and "apply plugin:' com.google.gms.google-services'" to the build.gradle files.
build.gradle project level:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
build.gradle app level:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "app"
minSdkVersion 16
targetSdkVersion 29
versionCode 42
versionName "16.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation 'androidx.navigation:navigation-ui:2.3.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// CloudPayments SDK
implementation 'ru.cloudpayments.android:sdk:1.0.5'
// add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-iid:20.2.4'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
implementation 'com.google.firebase:firebase-analytics:17.5.0'
}
apply plugin: 'com.google.gms.google-services'
When synchronizing the project, I get the error
No such property: applicationVariants for class: java.lang.String
which refers to the line "apply plugin: 'com.google.gms.google-services'" in build.gradle app level.
I ask for advice on how you can fix this error.
I solved this by checking all my gradle files and found out that, the gradle.properties file has some errors in it. I don’t know how they got there. But I replaced the file contents by copying the contents from a fresh android project.
Solved

Firebase Admin in backend module triggers "All firebase libraries must be either above or below 14.0.0

I have an android studio project that includes one module for my app and one module for my backend.
According to the documentation I can use the following code to bring all the build endpoint libraries to my app module:
endpointsServer project(path: ':backend', configuration: 'endpoints')
In my backend module gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.3'
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.5'
}
}
repositories {
jcenter(); }
apply plugin: 'java' apply plugin: 'war'
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
dependencies {
implementation 'com.google.endpoints:endpoints-framework:2.0.14'
implementation 'javax.servlet:servlet-api:2.5'
implementation 'javax.inject:javax.inject:1'
implementation 'com.google.firebase:firebase-admin:5.11.0'
}
appengine {
deploy {
stopPreviousVersion = false
promote = false
version = '1'
project = 'project-name'
} }
In my app module gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.cloud.tools.endpoints-framework-client'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
}
}
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "appID"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1"
multiDexEnabled = true
resConfigs "en", "fr"
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
debuggable false
}
debug {
signingConfig null
}
}
}
repositories {
flatDir {
dirs 'libs'
}
mavenCentral()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
implementation('com.crashlytics.sdk.android:crashlytics:2.9.2#aar') {
transitive = true;
}
implementation('com.firebaseui:firebase-ui-auth:3.3.1')
implementation 'com.google.firebase:firebase-core:15.0.2'
endpointsServer project(path: ':backend', configuration: 'endpoints')
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.api-client:google-api-client-android:1.23.0'
implementation 'com.google.http-client:google-http-client-android:1.23.0'
implementation 'com.google.http-client:google-http-client-gson:1.23.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.android.gms:play-services-gcm:15.0.0'
implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.8.5'
testImplementation 'junit:junit:4.12'
}
configurations {
all {
exclude module: 'httpclient'
}
}
apply plugin: 'com.google.gms.google-services'
The problem is that when gradle is executing is causing the following error:
All firebase libraries must be either above or below 14.0.0
I have already looked at:
How to add firebase-admin to my android project?
and
android firebase admin sdk error 'All firebase libraries must be either above or below 14.0.0' [duplicate]
But both of them are trying to add the admin sdk on client side. Which is not why I am trying to do.
So how can I tell gradle that this are two different modules or how can I exclude the admin sdk from coming to my app module when I am using:
endpointsServer project(path: ':backend', configuration: 'endpoints')

Resources