Fix gradle build for Firebase and GCM push

This commit is contained in:
Erwan Croze 2017-02-24 11:30:13 +01:00
parent 9e81c62df0
commit 8b8c67873b
4 changed files with 37 additions and 15 deletions

View file

@ -6,7 +6,7 @@ Linphone is a free VoIP and video softphone based on the SIP protocol.
1. Download the Android sdk (API 23 at least) with platform-tools and tools updated to latest revision, then add both 'tools' and 'platform-tools' folders in your path. 1. Download the Android sdk (API 23 at least) with platform-tools and tools updated to latest revision, then add both 'tools' and 'platform-tools' folders in your path.
2. Download the Android ndk (version r11c or 12b) from google and add it to your path (no symlink !!!). 2. Download the Android ndk (version r11c or 13b) from google and add it to your path (no symlink !!!).
3. Install _yasm_, _nasm_, _ant_, _python_, _intltoolize_, _cmake_ and _vim-common_. 3. Install _yasm_, _nasm_, _ant_, _python_, _intltoolize_, _cmake_ and _vim-common_.
* On 64 bits linux systems you'll need the _ia32-libs_ package. * On 64 bits linux systems you'll need the _ia32-libs_ package.
@ -56,6 +56,12 @@ Simply run `make liblinphone_tester`. This will be build everything, generate an
You can speed up the compilation by using ccache (compiler cache, see [ccache.samba.org](https://ccache.samba.org/)). Give the *"-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"* options to the *prepare.py* script. You can speed up the compilation by using ccache (compiler cache, see [ccache.samba.org](https://ccache.samba.org/)). Give the *"-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"* options to the *prepare.py* script.
# PUSH NOTIFICATION
## Firebase
To enable firebase in Linphone, just add your 'google-service.json' in project root and you key in 'res/values/non_localizable_custom.xml'
# TROUBLESHOOTING # TROUBLESHOOTING
If you encounter the following issue: If you encounter the following issue:

View file

@ -1,8 +1,10 @@
// Project information // Project information
buildDir = 'bin' buildDir = 'bin'
ext.linphonePackageName = "org.linphone" ext.linphonePackageName = "org.linphone"
File googleFile2 = new File('google-services.json')
buildscript { buildscript {
File googleFile = new File('google-services.json')
repositories { repositories {
jcenter() jcenter()
mavenCentral() mavenCentral()
@ -10,15 +12,26 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.2.0' classpath 'com.android.tools.build:gradle:2.2.0'
if (googleFile.exists()) {
classpath 'com.google.gms:google-services:3.0.0' classpath 'com.google.gms:google-services:3.0.0'
} }
} }
}
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
if (googleFile2.exists()) {
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
}
dependencies { dependencies {
File googleFile = new File('google-services.json')
compile fileTree(dir: 'libs', include: '*.jar') compile fileTree(dir: 'libs', include: '*.jar')
if (googleFile.exists()) {
compile 'com.google.firebase:firebase-messaging:9.0.0' compile 'com.google.firebase:firebase-messaging:9.0.0'
} else {
compile 'com.android.support:support-v4:+'
}
} }
android { android {
@ -54,6 +67,11 @@ android {
sourceSets { sourceSets {
main { main {
File googleFile = new File('google-services.json')
String firebase = ''
if (!googleFile.exists()) {
firebase = '**/Firebase*'
}
manifest.srcFile 'AndroidManifest.xml' manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['submodules/linphone/mediastreamer2/java/src','submodules/linphone/java/j2se','submodules/linphone/java/common','submodules/linphone/java/impl','submodules/externals/axmlrpc/src/main/java','submodules/linphone/coreapi/help/java','src'] java.srcDirs = ['submodules/linphone/mediastreamer2/java/src','submodules/linphone/java/j2se','submodules/linphone/java/common','submodules/linphone/java/impl','submodules/externals/axmlrpc/src/main/java','submodules/linphone/coreapi/help/java','src']
resources.srcDirs = ['submodules/linphone/mediastreamer2/java/src','submodules/linphone/java/j2se','submodules/linphone/java/common','submodules/linphone/java/impl','submodules/externals/axmlrpc/src/main/java','submodules/linphone/coreapi/help/java','src'] resources.srcDirs = ['submodules/linphone/mediastreamer2/java/src','submodules/linphone/java/j2se','submodules/linphone/java/common','submodules/linphone/java/impl','submodules/externals/axmlrpc/src/main/java','submodules/linphone/coreapi/help/java','src']
@ -64,6 +82,8 @@ android {
jniLibs.srcDir 'libs' jniLibs.srcDir 'libs'
java.exclude '**/mediastream/MediastreamerActivity.java' java.exclude '**/mediastream/MediastreamerActivity.java'
java.exclude firebase
println firebase
} }
// Move the tests to tests/java, tests/res, etc... // Move the tests to tests/java, tests/res, etc...

View file

@ -96,8 +96,6 @@ import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.google.firebase.iid.FirebaseInstanceId;
/** /**
* @author Sylvain Berfini * @author Sylvain Berfini
*/ */

View file

@ -108,8 +108,6 @@ import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.Toast; import android.widget.Toast;
import com.google.firebase.iid.FirebaseInstanceId;
/** /**
* *
* Manager of the low level LibLinphone stuff.<br /> * Manager of the low level LibLinphone stuff.<br />