From 08921222932491f42fa21b1ee5343a5e3db25b5a Mon Sep 17 00:00:00 2001 From: Luong Vo Date: Tue, 22 Aug 2023 18:14:31 +0700 Subject: [PATCH] [#513] Apply some more new configration from Gradle 8 --- template-compose/app/build.gradle.kts | 14 ++++++++++---- .../app/src/main/AndroidManifest.xml | 11 ++++++++--- .../app/src/main/res/xml/backup_rules.xml | 13 +++++++++++++ .../main/res/xml/data_extraction_rules.xml | 19 +++++++++++++++++++ template-compose/data/build.gradle.kts | 5 ++--- template-compose/data/consumer-rules.pro | 0 .../data/src/main/AndroidManifest.xml | 2 +- 7 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 template-compose/app/src/main/res/xml/backup_rules.xml create mode 100644 template-compose/app/src/main/res/xml/data_extraction_rules.xml create mode 100644 template-compose/data/consumer-rules.pro diff --git a/template-compose/app/build.gradle.kts b/template-compose/app/build.gradle.kts index 2296909d5..b1ff903fc 100644 --- a/template-compose/app/build.gradle.kts +++ b/template-compose/app/build.gradle.kts @@ -47,7 +47,7 @@ android { } buildTypes { - getByName(BuildTypes.RELEASE) { + release { isMinifyEnabled = true isDebuggable = false isShrinkResources = true @@ -56,7 +56,7 @@ android { buildConfigField("String", "BASE_API_URL", "\"https://jsonplaceholder.typicode.com/\"") } - getByName(BuildTypes.DEBUG) { + debug { // For quickly testing build with proguard, enable this isMinifyEnabled = false signingConfig = signingConfigs[BuildTypes.DEBUG] @@ -86,12 +86,18 @@ android { jvmTarget = JavaVersion.VERSION_17.toString() } + buildFeatures { + compose = true + } + composeOptions { kotlinCompilerExtensionVersion = Versions.COMPOSE_COMPILER } - buildFeatures { - compose = true + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } } lint { diff --git a/template-compose/app/src/main/AndroidManifest.xml b/template-compose/app/src/main/AndroidManifest.xml index 1bae8bf99..cfb421214 100644 --- a/template-compose/app/src/main/AndroidManifest.xml +++ b/template-compose/app/src/main/AndroidManifest.xml @@ -1,20 +1,25 @@ + xmlns:tools="http://schemas.android.com/tools"> + android:theme="@style/AppTheme" + tools:targetApi="31"> - + diff --git a/template-compose/app/src/main/res/xml/backup_rules.xml b/template-compose/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 000000000..148c18b65 --- /dev/null +++ b/template-compose/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + diff --git a/template-compose/app/src/main/res/xml/data_extraction_rules.xml b/template-compose/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 000000000..0c4f95cab --- /dev/null +++ b/template-compose/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/template-compose/data/build.gradle.kts b/template-compose/data/build.gradle.kts index ed965d65c..417bc2178 100644 --- a/template-compose/data/build.gradle.kts +++ b/template-compose/data/build.gradle.kts @@ -10,20 +10,19 @@ android { defaultConfig { minSdk = Versions.ANDROID_MIN_SDK - targetSdk = Versions.ANDROID_TARGET_SDK consumerProguardFiles("consumer-rules.pro") } buildTypes { - getByName(BuildTypes.RELEASE) { + release { isMinifyEnabled = true proguardFiles( getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" ) } - getByName(BuildTypes.DEBUG) { + debug { isMinifyEnabled = false } } diff --git a/template-compose/data/consumer-rules.pro b/template-compose/data/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/template-compose/data/src/main/AndroidManifest.xml b/template-compose/data/src/main/AndroidManifest.xml index 1e37650d4..8072ee00d 100644 --- a/template-compose/data/src/main/AndroidManifest.xml +++ b/template-compose/data/src/main/AndroidManifest.xml @@ -1,2 +1,2 @@ - +