Skip to content

Commit 4cfece4

Browse files
committed
Fix apk build issue
1 parent 1510112 commit 4cfece4

File tree

8 files changed

+22
-16
lines changed

8 files changed

+22
-16
lines changed

.github/workflows/generate-apk-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ jobs:
3939
draft: true
4040
prerelease: false
4141
artifacts: ./app/build/outputs/apk/github/release/PlainApp-${{ env.version_name }}.apk,./app/build/outputs/apk/china/release/PlainApp-${{ env.version_name }}-china.apk
42+

app/build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ android {
121121

122122
buildFeatures {
123123
buildConfig = true
124-
viewBinding = true
125-
dataBinding = true
126124
compose = true
127125
}
128126

@@ -143,6 +141,7 @@ android {
143141
}
144142

145143
dependencies {
144+
implementation(project(":lib"))
146145

147146
implementation(platform(libs.compose.bom))
148147

@@ -216,7 +215,6 @@ dependencies {
216215
implementation(libs.androidx.datastore.preferences)
217216

218217
implementation(libs.zt.zip)
219-
implementation(project(":lib"))
220218
debugImplementation(libs.leakcanary.android)
221219
implementation(kotlin("stdlib", libs.versions.kotlin.get()))
222220
}
-13.7 KB
Binary file not shown.
-13.6 KB
Binary file not shown.

app/src/main/java/com/ismartcoding/plain/ui/models/MenuItemModel.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package com.ismartcoding.plain.ui.models
22

3-
import androidx.databinding.BaseObservable
4-
5-
open class MenuItemModel(val data: Any? = null) : BaseObservable() {
3+
class MenuItemModel(val data: Any? = null) {
64
var title: String = ""
75
var iconId: Int = 0
86
var count: Int = 0

build-apk.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,27 @@
33
function err_and_exit()
44
{
55
echo "$1" >&2
6+
try_print_missing_rules
67
exit 1
78
}
89

9-
function getVersionName()
10+
function getVersionName()
1011
{
1112
echo $(grep versionName ./app/build.gradle.kts | awk -F '"' '{print $2}')
1213
}
1314

15+
function try_print_missing_rules()
16+
{
17+
MISSING_FILE="./app/build/outputs/mapping/githubRelease/missing_rules.txt"
18+
if [ -f "$MISSING_FILE" ]; then
19+
echo "========== R8 missing_rules.txt =========="
20+
cat "$MISSING_FILE"
21+
echo "=========================================="
22+
else
23+
echo "[WARN] missing_rules.txt not found at $MISSING_FILE"
24+
fi
25+
}
26+
1427
cat > ./keystore.properties <<EOF
1528
storePassword=$ANDROID_STORE_PASSWORD
1629
keyPassword=$ANDROID_KEY_PASSWORD
@@ -22,11 +35,11 @@ cat > ./local.properties <<EOF
2235
sdk.dir=/Users/$USER/Library/Android/sdk
2336
EOF
2437

25-
./gradlew assembleGithubRelease || err_and_exit "build failed"
26-
./gradlew assembleChinaRelease || err_and_exit "build failed"
38+
./gradlew assembleGithubRelease || err_and_exit "assembleGithubRelease failed"
39+
./gradlew assembleChinaRelease || err_and_exit "assembleChinaRelease failed"
2740

2841
BUILD_FILE="PlainApp-$(getVersionName).apk"
2942
mv ./app/build/outputs/apk/github/release/app-github-release.apk ./app/build/outputs/apk/github/release/$BUILD_FILE
3043

3144
BUILD_FILE="PlainApp-$(getVersionName)-china.apk"
32-
mv ./app/build/outputs/apk/china/release/app-china-release.apk ./app/build/outputs/apk/china/release/$BUILD_FILE
45+
mv ./app/build/outputs/apk/china/release/app-china-release.apk ./app/build/outputs/apk/china/release/$BUILD_FILE

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ leakcanaryAndroidVersion = "2.12"
3030
lifecycleExtensionsVersion="2.2.0"
3131
lifecycleViewmodelKtxVersion="2.8.7"
3232
markwon="4.6.2"
33-
media3 = "1.4.1"
33+
media3 = "1.7.1"
3434
navigationComposeVersion = "2.8.6"
3535
material3Version = "1.3.2"
3636
okhttpVersion="4.12.0"

lib/build.gradle.kts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ android {
2020
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
2121
}
2222
release {
23-
isMinifyEnabled = true
23+
isMinifyEnabled = false
2424
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
2525
}
2626
}
27-
buildFeatures {
28-
viewBinding = true
29-
dataBinding = true
30-
}
3127
compileOptions {
3228
sourceCompatibility = JavaVersion.VERSION_17
3329
targetCompatibility = JavaVersion.VERSION_17

0 commit comments

Comments
 (0)