feat: allow android apps with any name, fix android + windows for aarch64 target (#3213)

* use llvm objcopy to rename syms
* use handlebars
* it works!
* remove linker code
* better docs internally about dev.dioxus.main
* use bundle identifier
* double check bundle identifier is proper
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-11-13 18:48:21 -05:00
1 parent 1370bce182
commit 8a2922c663
13 files changed
+173 -79

No files matched your search

+37 -24
View File
@@ -21,6 +21,8 @@ use tokio::{
/// We might want to bring in websockets here too, so we know the exact channels the app is using to
/// communicate with the devserver. Currently that's a broadcast-type system, so this struct isn't super
/// duper useful.
///
/// todo: restructure this such that "open" is a running task instead of blocking the main thread
pub(crate) struct AppHandle {
pub(crate) app: AppBundle,
@@ -266,7 +268,7 @@ impl AppHandle {
.arg("launch")
.arg("--console")
.arg("booted")
.arg(self.app.bundle_identifier())
.arg(self.app.build.krate.bundle_identifier())
.envs(ios_envs)
.stderr(Stdio::piped())
.stdout(Stdio::piped())
@@ -451,30 +453,41 @@ impl AppHandle {
unimplemented!("dioxus-cli doesn't support ios devices yet.")
}
async fn open_android_sim(&self, envs: Vec<(&str, String)>) -> Result<()> {
// Install
// adb install -r app-debug.apk
let _output = Command::new("adb")
.arg("install")
.arg("-r")
.arg(self.app.apk_path())
.stderr(Stdio::piped())
.stdout(Stdio::piped())
.output()
.await?;
async fn open_android_sim(&self, envs: Vec<(&'static str, String)>) -> Result<()> {
let apk_path = self.app.apk_path();
let full_mobile_app_name = self.app.build.krate.full_mobile_app_name();
// adb shell am start -n com.example.androidfinal/com.example.androidfinal.MainActivity
let _output = Command::new("adb")
.arg("shell")
.arg("am")
.arg("start")
.arg("-n")
.arg("com.example.androidfinal/com.example.androidfinal.MainActivity")
.envs(envs)
.stderr(Stdio::piped())
.stdout(Stdio::piped())
.output()
.await?;
// Start backgrounded since .open() is called while in the arm of the top-level match
tokio::task::spawn(async move {
// Install
// adb install -r app-debug.apk
let _output = Command::new("adb")
.arg("install")
.arg("-r")
.arg(apk_path)
.stderr(Stdio::piped())
.stdout(Stdio::piped())
.output()
.await?;
// eventually, use the user's MainAcitivty, not our MainAcitivty
// adb shell am start -n dev.dioxus.main/dev.dioxus.main.MainActivity
let activity_name = format!("{}/dev.dioxus.main.MainActivity", full_mobile_app_name,);
let _output = Command::new("adb")
.arg("shell")
.arg("am")
.arg("start")
.arg("-n")
.arg(activity_name)
.envs(envs)
.stderr(Stdio::piped())
.stdout(Stdio::piped())
.output()
.await?;
Result::<()>::Ok(())
});
Ok(())
}
+1 -1
View File
@@ -275,7 +275,7 @@ impl AppRunner {
.arg("simctl")
.arg("get_app_container")
.arg("booted")
.arg(runner.app.bundle_identifier())
.arg(runner.app.build.krate.bundle_identifier())
.output()
.await;