Skip to content

Commit

Permalink
fix(android): generate correct template (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir authored Oct 4, 2023
1 parent 79a6d32 commit 02dd3e3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
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

0 comments on commit 02dd3e3

Please sign in to comment.