feat(cli): add bundle.android config to build and sign the apk file in release mode (#4062)

* feat(cli): add `bundle.android` config to build and sign the apk file in release mode

Add this to `Dioxus.toml`

```toml
[bundle.android]
jks_file = "path/to/jks file relative to Dioxus.toml"
jks_password = "jks_password "
key_alias = "key_alias"
key_password = "key_password "
```

When release flag is enabled and this configuration exists  at the same time, use `gradlew assembleRelease` build and sign apk file

* fix merge conflict

* only run assembleRelease when bundle exists

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
FontlosandJonathan Kelley authored and GitHub committed 2025-05-07 14:22:59 -07:00
1 parent ad63d529fd
commit 7d5bd44791
3 files changed
+34 -2

No files matched your search

@@ -13,6 +13,16 @@ android {
versionCode = 1
versionName = "1.0"
}
{{#if android_bundle}}
signingConfigs {
create("release") {
storeFile = file("../../../../../../../{{ android_bundle.jks_file }}")
storePassword = "{{ android_bundle.jks_password }}"
keyAlias = "{{ android_bundle.key_alias }}"
keyPassword = "{{ android_bundle.key_password }}"
}
}
{{/if}}
buildTypes {
getByName("debug") {
isDebuggable = true
@@ -27,7 +37,10 @@ android {
}
getByName("release") {
isMinifyEnabled = true
proguardFiles(
{{#if android_bundle}}
signingConfig = signingConfigs.getByName("release")
{{/if}}
proguardFiles(
*fileTree(".") { include("**/*.pro") }
.plus(getDefaultProguardFile("proguard-android-optimize.txt"))
.toList().toTypedArray()