2

Manually, we can run:

adb shell su chmod 666 /dev/graphics/fb0 export CLASSPATH=/data/local/device.jar export LD_LIBRARY_PATH=/data/local exec app_process /system/bin com.device.client.Main /data/local/device.conf & 

However, we need to be able to run that from a bash script on the computer compiling the program.

I have tried:

adb shell "su && chmod 666 /dev/graphics/fb0 && export CLASSPATH=/data/local/device.jar && export LD_LIBRARY_PATH=/data/local && exec app_process /system/bin com.device.client.Main /data/local/device.conf &" 

But since we are entering the su shell, this does not work.

Can you please suggest a solution?

2
  • In what sense does it "not work"?CommentedNov 12, 2011 at 22:34
  • 1
    The command ends up in the adb shell, and does not execute the commands after that. When you call su the code I had would have made "su" run in adb shell then not the next commandsCommentedNov 12, 2011 at 22:42

1 Answer 1

8

Try this:

adb shell "su -c ' chmod 666 /dev/graphics/fb0 && export CLASSPATH=/data/local/device.jar && export LD_LIBRARY_PATH=/data/local && exec app_process /system/bin com.device.client.Main /data/local/device.conf &'" 

It might be possible to simplify it, too:

adb shell "su -c ' chmod 666 /dev/graphics/fb0 && CLASSPATH=/data/local/device.jar LD_LIBRARY_PATH=/data/local app_process /system/bin com.device.client.Main /data/local/device.conf &'" 

This is because you can set environment variables for one job just by prepending them on the line, rather than the export this, export that form.

1
  • 1
    [1] Killed su -c " chmod 66... the device is not recognized anymore! crashed still...CommentedNov 12, 2011 at 23:11

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.