Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): generate correct template #214

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/android-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-mobile": "patch"
---

Fix Android template generation.
9 changes: 6 additions & 3 deletions src/android/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,15 @@ pub fn gen(
map.insert("android-app-plugins", metadata.app_plugins());
map.insert(
"android-project-dependencies",
metadata.project_dependencies(),
metadata.project_dependencies().unwrap_or_default(),
);
map.insert(
"android-app-dependencies",
metadata.app_dependencies().unwrap_or_default(),
);
map.insert("android-app-dependencies", metadata.app_dependencies());
map.insert(
"android-app-dependencies-platform",
metadata.app_dependencies_platform(),
metadata.app_dependencies_platform().unwrap_or_default(),
);
map.insert(
"has-code",
Expand Down
14 changes: 5 additions & 9 deletions templates/platforms/android-studio/app/build.gradle.kts.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id("com.android.application")
id("rust")
{{#if android-app-plugins}}{{~#each android-app-plugins}}
id("rust"){{#if android-app-plugins}}{{~#each android-app-plugins}}
id("{{this}}"){{/each}}{{/if}}
}

Expand All @@ -26,8 +25,7 @@ android {
isDebuggable = true
isJniDebuggable = true
isMinifyEnabled = false
packaging {
{{~#each abi-list}}
packaging { {{~#each abi-list}}
jniLibs.keepDebugSymbols.add("*/{{this}}/*.so"){{/each}}
}
}
Expand All @@ -49,9 +47,7 @@ rust {
rootDirRel = "{{root-dir-rel}}"
}

dependencies {
{{#if android-app-dependencies-platform}}{{~#each android-app-dependencies-platform}}
implementation(platform("{{this}}")){{/each}}{{/if}}
{{#if android-app-dependencies}}{{~#each android-app-dependencies}}
implementation("{{this}}"){{/each}}{{/if}}
dependencies { {{~#each android-app-dependencies-platform}}
implementation(platform("{{this}}")){{/each}}{{~#each android-app-dependencies}}
implementation("{{this}}"){{/each}}
}
5 changes: 2 additions & 3 deletions templates/platforms/android-studio/build.gradle.kts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:8.0.0")
{{#if android-project-dependencies}}{{~#each android-project-dependencies}}
classpath("{{this}}"){{/each}}{{/if}}
classpath("com.android.tools.build:gradle:8.0.0"){{~#each android-project-dependencies}}
classpath("{{this}}"){{/each}}
}
}

Expand Down
Loading