Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running android java based command-line utility from adb shell [duplicate]

I'm trying to create a new java command-line utility based on java input command from AOSP: (https://github.com/android/platform_frameworks_base/tree/master/cmds/input)

I've compiled the jar using mmm and pushed it over to the android device over ADB. I then used ADB shell to execute the command:

export CLASSPATH = /sdcard/input2.jar
exec app_process / com.android.commands.input.Input

Using a rooted device, this work perfectly, But when I tried to run it on non-rooted device I got this exception on LOGCAT:

E/dalvikvm(31966): Dex cache directory isn't writable: /data/dalvik-cache
I/dalvikvm(31966): Unable to open or create cache for /sdcard/input2.jar (/data/dalvik-cache/[email protected]@classes.dex)
E/appproc(31966): ERROR: could not find class 'com.android.commands.input.Input'

Any ideas?

Thanks

like image 999
Yshayy Avatar asked Dec 05 '25 15:12

Yshayy


1 Answers

With the ADB shell, you can set the dalvik-cache directory to other directory with write permissions.

Try this before executing your module:

  • mkdir /data/local/tmp/dalvik-cache
  • export ANDROID_DATA=/data/local/tmp
like image 185
ZahiC Avatar answered Dec 07 '25 05:12

ZahiC