Skip to content

Commit

Permalink
Add 300ms sleep before calling apk.start.
Browse files Browse the repository at this point in the history
  • Loading branch information
jingchan committed Oct 1, 2022
1 parent b488fb9 commit 9056353
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cargo-apk/src/apk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use ndk_build::manifest::{IntentFilter, MetaData};
use ndk_build::ndk::{Key, Ndk};
use ndk_build::target::Target;
use std::path::PathBuf;
use std::thread;
use std::time;

pub struct ApkBuilder<'a> {
cmd: &'a Subcommand,
Expand Down Expand Up @@ -239,6 +241,10 @@ impl<'a> ApkBuilder<'a> {
pub fn run(&self, artifact: &Artifact, no_logcat: bool) -> Result<(), Error> {
let apk = self.build(artifact)?;
apk.install(self.device_serial.as_deref())?;

// Delay 300ms while waiting for process ID to become available.
thread::sleep(time::Duration::from_millis(300));

let pid = apk.start(self.device_serial.as_deref())?;

if !no_logcat {
Expand Down

0 comments on commit 9056353

Please sign in to comment.