Do not attempt to use google json (firebase) in a gradle library. The google-service plugin is made for applications only.

Otherwise you'll get obscure compilation errors.
This commit is contained in:
Simon Morlat 2018-06-07 14:18:38 +02:00
parent 048f01ff5a
commit ae70d532ec
2 changed files with 7 additions and 24 deletions

View file

@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip

View file

@ -1,12 +1,8 @@
// Project information
buildDir = 'bin'
def firebaseEnable() {
File googleFile = new File('google-services.json')
return googleFile.exists()
}
buildscript {
File googleFile = new File('google-services.json')
repositories {
jcenter()
mavenCentral()
@ -15,9 +11,6 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
if (googleFile.exists()) {
classpath 'com.google.gms:google-services:3.1.0'
}
}
}
@ -34,16 +27,7 @@ apply plugin: 'com.android.library'
dependencies {
compile group: 'org.apache.commons', name: 'commons-compress', version: '+'
if (firebaseEnable()) {
compile 'com.google.firebase:firebase-messaging:11.+'
} else {
compile fileTree(include: 'gcm.jar', dir: 'libs')
compile 'com.android.support:support-v4:+'
}
}
if (firebaseEnable()) {
apply plugin: 'com.google.gms.google-services'
compile 'com.android.support:support-v4:26.0.2'
}
@ -56,11 +40,9 @@ def srcDirs = ['submodules/mediastreamer2/java/src',
def excludeFiles = []
// Exclude firebase file if not enable
if (!firebaseEnable()) {
excludeFiles.add('**/Firebase*')
} else {
excludeFiles.add('**/gcm*')
}
excludeFiles.add('**/Firebase*')
excludeFiles.add('**/gcm*')
excludeFiles.add('**/mediastream/MediastreamerActivity.java')
def excludePackage = []