0

Basically i want to build an executable file with dependency on android libraries, copy it multiple folders on runtime and run within my apk (probably with Runtime.getRuntime().exec(cmd); ?) I've tried that with no luck:

package com.example.hello;

import android.util.Log;

public class Hello {
    public static void main(String[] args) {
        System.load("/system/lib/libandroid_runtime.so"); // this line didnt help
        Log.wtf("hello", "main: hasdsd");
    }
}

When i compile it to jar, make a dex out of it and try to run with dalvikvm -cp command on terminal it throws linker error because of android.util.Log usage.

Im using Android Studio but ready to install Eclipse if needed. Thanks

ömer hayyam
  • 173
  • 6
  • 1
    Unclear what you are trying to achieve. Run C/C++ in Android, look at [Android NDK](https://developer.android.com/ndk/guides). Run Android app as PC app, see [Can I run an android app on pc without emulator?](https://stackoverflow.com/q/37485080/295004) – Morrison Chang May 13 '20 at 22:29
  • Title includes jar, question has java code, i want to run java as a seperate process from my apk, that process uses android libraries. – ömer hayyam May 13 '20 at 23:09
  • Rooted or unrooted device? I suspect that this question is a duplicate of [CLI on DalvikVM fails on JNI lib](https://stackoverflow.com/q/13000561/295004) – Morrison Chang May 13 '20 at 23:37
  • Unrooted. Yes i saw that answer but first answer depends on no more supported hack. to try other answer when i type exec app_process in avd it says there isnt such a command? if with your help i can manage to run app_process will it work below android m? – ömer hayyam May 13 '20 at 23:59
  • played a bit changed the path for app_process to exec /system/bin/app_process then run with sh /sdcard/download/run.sh it says aborted. i guess i need to copy it to system/bin thus its only for rooted phones? – ömer hayyam May 14 '20 at 00:20

0 Answers0