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:
parent
048f01ff5a
commit
ae70d532ec
2 changed files with 7 additions and 24 deletions
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
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
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
// Project information
|
// Project information
|
||||||
buildDir = 'bin'
|
buildDir = 'bin'
|
||||||
def firebaseEnable() {
|
|
||||||
File googleFile = new File('google-services.json')
|
|
||||||
return googleFile.exists()
|
|
||||||
}
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
File googleFile = new File('google-services.json')
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -15,9 +11,6 @@ buildscript {
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.1.0'
|
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 {
|
dependencies {
|
||||||
compile group: 'org.apache.commons', name: 'commons-compress', version: '+'
|
compile group: 'org.apache.commons', name: 'commons-compress', version: '+'
|
||||||
if (firebaseEnable()) {
|
compile 'com.android.support:support-v4:26.0.2'
|
||||||
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'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,11 +40,9 @@ def srcDirs = ['submodules/mediastreamer2/java/src',
|
||||||
|
|
||||||
def excludeFiles = []
|
def excludeFiles = []
|
||||||
// Exclude firebase file if not enable
|
// Exclude firebase file if not enable
|
||||||
if (!firebaseEnable()) {
|
|
||||||
excludeFiles.add('**/Firebase*')
|
excludeFiles.add('**/Firebase*')
|
||||||
} else {
|
excludeFiles.add('**/gcm*')
|
||||||
excludeFiles.add('**/gcm*')
|
|
||||||
}
|
|
||||||
excludeFiles.add('**/mediastream/MediastreamerActivity.java')
|
excludeFiles.add('**/mediastream/MediastreamerActivity.java')
|
||||||
|
|
||||||
def excludePackage = []
|
def excludePackage = []
|
||||||
|
|
Loading…
Reference in a new issue