From 0c96889528a745144aa14ae09247580f2dd593ad Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 16 Oct 2020 10:41:05 +0200 Subject: [PATCH] Added new releaseAppBundle target that adds full native libraries symbols --- .gitignore | 1 + README.md | 4 ++++ app/build.gradle | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 3a7e562bd..56cbd2768 100644 --- a/.gitignore +++ b/.gitignore @@ -23,5 +23,6 @@ res/value-hi_IN linphone-sdk-android/*.aar app/debug app/release +app/releaseAppBundle keystore.properties app/src/main/res/xml/contacts.xml diff --git a/README.md b/README.md index 3b3b739a9..7ef2b3340 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,10 @@ to install the generated APK in the previous step (use installRelease instead if APK files are stored within ```./app/build/outputs/apk/debug/``` and ```./app/build/outputs/apk/release/``` directories. +When building a release AppBundle, use releaseAppBundle target instead of release. +Also make sure you have a NDK installed and that you have an environment variable named ```ANDROID_NDK_HOME``` that contains the path to the NDK. +This is to be able to include native libraries symbols into app bundle for the Play Store. + ## Building a local SDK 1. Clone the linphone-sdk repository from out gitlab: diff --git a/app/build.gradle b/app/build.gradle index 11bdc115a..78711ca51 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -60,7 +60,14 @@ android { versionName "${project.version}" applicationId getPackageName() } - ndkVersion "21.3.6528147" + + // Required to be able to generate app bundle with native libraries symbols, see releaseAppBundle below + def ndkHome = System.getenv('ANDROID_NDK_HOME') + if (ndkHome == null || !new File(ndkHome + "/source.properties").exists()) { + ndkVersion "21.3.6528147" + } else { + ndkPath ndkHome + } applicationVariants.all { variant -> variant.outputs.all { @@ -68,7 +75,7 @@ android { } // See https://developer.android.com/studio/releases/gradle-plugin#3-6-0-behavior for why extractNativeLibs is set to true in debug flavor - if (variant.buildType.name == "release") { + if (variant.buildType.name == "release" || variant.buildType.name == "releaseAppBundle") { variant.getMergedFlavor().manifestPlaceholders = [linphone_address_mime_type: "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address", linphone_file_provider: getPackageName() + ".fileprovider", appLabel: "@string/app_name", @@ -96,7 +103,6 @@ android { buildTypes { release { - ndk.debugSymbolLevel = 'SYMBOL_TABLE' minifyEnabled true signingConfig signingConfigs.release proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' @@ -110,6 +116,11 @@ android { } } + releaseAppBundle { + initWith release + ndk.debugSymbolLevel = 'FULL' + } + debug { applicationIdSuffix ".debug" debuggable true