Simplified use of locally built linphone-sdk AAR

This commit is contained in:
Sylvain Berfini 2020-02-21 15:07:24 +01:00
parent aaa0b7b7bd
commit 4ba26a6775
5 changed files with 10 additions and 44 deletions

View file

@ -67,11 +67,9 @@ git clone https://gitlab.linphone.org/BC/public/linphone-sdk.git --recursive
2. Follow the instructions in the linphone-sdk/README file to build the SDK.
3. Edit in the linphone-sdk-android folder of this project the symbolic link (debug and/or release) to the generated AAR.
We recommend to at least create the link for the release AAR that can be used for debug APK flavor because it is smaller and will reduce the time required to install the APK.
3. Create or edit the gradle.properties file in $GRADLE_USER_HOME (usually ~/.gradle) file and add the absolute path to your linphone-sdk build directory, for example:
```
ln -s <path to linphone-sdk>/linphone-sdk/build/linphone-sdk/bin/outputs/aar/linphone-sdk-android-release.aar linphone-sdk-android/linphone-sdk-android-release.aar
ln -s <path to linphone-sdk>/linphone-sdk/build/linphone-sdk/bin/outputs/aar/linphone-sdk-android-debug.aar linphone-sdk-android/linphone-sdk-android-debug.aar
LinphoneSdkBuildDir=/home/<username>/linphone-sdk/build/
```
4. Rebuild the app in Android Studio.

View file

@ -9,20 +9,6 @@ static def firebaseEnabled() {
return googleFile.exists()
}
static def isLocalDebugAarAvailable() {
File debugAar = new File('linphone-sdk-android/linphone-sdk-android-debug.aar')
return debugAar.exists()
}
static def isLocalReleaseAarAvailable() {
File releaseAar = new File('linphone-sdk-android/linphone-sdk-android-release.aar')
return releaseAar.exists()
}
static def isLocalAarAvailable() {
return isLocalDebugAarAvailable() || isLocalReleaseAarAvailable()
}
task getGitVersion() {
def gitVersion = "4.3.0"
def gitVersionStream = new ByteArrayOutputStream()
@ -76,6 +62,9 @@ excludePackage.add('**/LICENSE.txt')
/////////////////////////
repositories {
maven {
url file(LinphoneSdkBuildDir + '/maven_repository/')
}
maven {
url "https://linphone.org/maven_repository"
}
@ -103,7 +92,7 @@ android {
outputFileName = "linphone-android-${variant.buildType.name}-${project.version}.apk"
}
if (variant.buildType.name.equals("release")) {
if (variant.buildType.name == "release") {
variant.getMergedFlavor().manifestPlaceholders = [linphone_address_mime_type: "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address",
linphone_file_provider: getPackageName() + ".provider"]
} else {
@ -172,6 +161,7 @@ android {
}
dependencies {
compileOnly 'org.jetbrains:annotations:19.0.0'
if (firebaseEnabled()) {
implementation 'com.google.firebase:firebase-messaging:19.0.1'
}
@ -179,18 +169,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android:flexbox:1.1.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
if (isLocalAarAvailable()) {
if (isLocalReleaseAarAvailable()) {
//debug AAR is a lot bigger than release one, and APK install time will be much longer so use release one for day-to-day development
implementation project(path: ":linphone-sdk-android", configuration: 'release')
} else {
releaseImplementation project(path: ":linphone-sdk-android", configuration: 'release')
debugImplementation project(path: ":linphone-sdk-android", configuration: 'debug')
}
} else {
implementation "org.linphone:linphone-sdk-android:4.4+"
}
implementation "org.linphone:linphone-sdk-android:4.4+"
}
if (firebaseEnabled()) {
apply plugin: 'com.google.gms.google-services'

View file

@ -7,3 +7,4 @@ RELEASE_KEY_PASSWORD=
org.gradle.jvmargs=-Xmx2g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
LinphoneSdkBuildDir=

View file

@ -1,12 +0,0 @@
configurations.maybeCreate("debug")
configurations.maybeCreate("release")
File debugAar = new File('linphone-sdk-android/linphone-sdk-android-debug.aar')
File releaseAar = new File('linphone-sdk-android/linphone-sdk-android-release.aar')
if (debugAar.exists()) {
artifacts.add("debug", file('linphone-sdk-android-debug.aar'))
}
if (releaseAar.exists()) {
artifacts.add("release", file('linphone-sdk-android-release.aar'))
}

View file

@ -1 +1 @@
include ':app', ':linphone-sdk-android'
include ':app'