feat: add multi-architecture APK support for all Android platforms

This commit is contained in:
Nedifinita
2025-07-15 14:33:37 +08:00
parent 8b16b4c5d2
commit 10d4c341a7
5 changed files with 71 additions and 22 deletions

View File

@@ -13,6 +13,9 @@ permissions:
jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
abi: ["arm64-v8a", "armeabi-v7a", "x86", "x86_64"]
steps:
- name: Checkout repository
@@ -40,18 +43,48 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Release APK
- name: Modify build.gradle for specific ABI
run: |
sed -i 's/abiFilters += listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64")/abiFilters += listOf("${{ matrix.abi }}")/g' app/build.gradle.kts
- name: Build Release APK for ${{ matrix.abi }}
run: ./gradlew assembleRelease
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
- name: Rename APK with ABI suffix
run: |
cd app/build/outputs/apk/release
for file in *.apk; do
mv "$file" "${file%.apk}-${{ matrix.abi }}.apk"
done
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: apk-${{ matrix.abi }}
path: app/build/outputs/apk/release/*-${{ matrix.abi }}.apk
create-release:
needs: release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all APK artifacts
uses: actions/download-artifact@v4
with:
path: apks
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: app/build/outputs/apk/release/*.apk
files: |
apks/**/*.apk
generate_release_notes: true
name: ${{ github.ref_name }}
body: ""
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored
View File

@@ -13,3 +13,4 @@ captures
.cxx
local.properties
local.properties
*.ps1

6
.idea/appInsightsSettings.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AppInsightsSettings">
<option name="selectedTabId" value="Android Vitals" />
</component>
</project>

View File

@@ -16,17 +16,31 @@ android {
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters += listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
}
}
buildTypes {
release {
isMinifyEnabled = false
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
splits {
abi {
isEnable = true
reset()
include("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
isUniversalApk = true
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

View File

@@ -1,21 +1,16 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
-keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-keep class org.json.** { *; }
-keep class org.osmdroid.** { *; }
-keep class org.mapsforge.** { *; }
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
-keepclassmembers class * {
@androidx.compose.runtime.Composable <methods>;
}
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class androidx.compose.** { *; }
-keep class kotlin.** { *; }
-dontwarn org.osmdroid.**
-dontwarn org.mapsforge.**