Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 10 - alternative to launching executable as subproccess stored in app home directory

I have an android app (C#, Xamarin) that

  1. bundles a python environment with its apk.
  2. extracts the python files into an the app files directory.
  3. runs python code, by executing the python executable as a sub process.

This worked for years, but now on android 10, I'm getting:

Write fault on path /[Unknown] error (which is likely the Xamarin wrapper of the real error).

I assume this is caused by the following android 10 changes: "Removed execute permission for app home directory"

(Although if I adb in and runas the app user, executing the python executable works fine.)

My testing showed that: In general running subproccess still works. (eg /system/bin/echo) But executing any subprocess, that exists in the apps home/files directory generates the Write fault on path /[Unknown] error.

In the android 10 changes file, the suggested alternative approach is to:

Apps should load only the binary code that's embedded within an app's APK file.

As far as I'm aware one can't get a file path to an embedded apk file.

Is there a way of executing (eg. Runtime.exec()) a (binary/native) file embedded in the apk?

like image 942
Tom Avatar asked Jun 15 '20 15:06

Tom


1 Answers

This is a just a short term workaround (rather than a proper answer):

change android targetSdkVersion from 29 to 28

This means, that things should work even on android 10 devices, however it has the following limitations:

  1. You can never upgrade the target sdk version.
  2. At some point in future the google play store will not allow app uploads that target older sdk versions, means you can't post upgrades to your app.
like image 133
Tom Avatar answered Nov 12 '22 20:11

Tom