Skip to content

Commit

Permalink
Fix mobile-install v1 error when incrementally installing the native
Browse files Browse the repository at this point in the history
libs' manifest onto the device

Somewhere between 28 and 29, when creating directories as part of adb push, the behavior changed w.r.t. directory permissions.

On 28, the created directories via adb push have the permissions drwxrwxr-x.
On 29, the permissions are drwxrwx--x. The difference is the read permission for others. For some reason, this causes the adb push to fail.

It turns out that inserting a adb shell mkdir -p /data/local/tmp/incrementaldeployment/com.example.android.bazel/native/ before pushing the files creates the directory with the correct permissions, allowing native_manifest to be pushed correctly.

Fixes bazelbuild/examples#77
Fixes #6814

RELNOTES: Fixed mobile-install v1 error when installing an app with native libraries onto an Android 9 (Pie) device. See bazelbuild/examples#77
PiperOrigin-RevId: 224928364
  • Loading branch information
jin authored and Copybara-Service committed Dec 11, 2018
1 parent a2d4d3d commit b3f28d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/android/incremental_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,12 @@ def UploadNativeLibs(adb, native_lib_args, app_dir, full_install):
# If we couldn't fetch the device manifest or if this is a non-incremental
# install, wipe the slate clean
adb.Delete(targetpath.join(app_dir, "native"))

# From Android 28 onwards, `adb push` creates directories with insufficient
# permissions, resulting in errors when pushing files. `adb shell mkdir`
# works correctly however, so we create the directory here.
# See https://github.com/bazelbuild/examples/issues/77 for more information.
adb.Mkdir(targetpath.join(app_dir, "native"))
else:
# Otherwise, parse the manifest. Note that this branch is also taken if the
# manifest is empty.
Expand Down

0 comments on commit b3f28d3

Please sign in to comment.