sinkuri256 / android-scripting

Automatically exported from code.google.com/p/android-scripting
0 stars 0 forks source link

Rhino and Beanshell do not work on Cyanogen #389

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
(NOTE: I don't know how to re-open an issue, so I am filing this and providing 
a link to the appropriate material.)

What steps will reproduce the problem?
1. Install SL4A, then add Beanshell and Rhino interpreters via the appropriate 
menu options.
2.  Try to run one of the provided scripts.

What is the expected output? What do you see instead?
Don't know what is expected -- have never seen it working.  What I *saw* 
(again) was a 'class not found' error.

What version of the product are you using? On what operating system?
SL4A_R0 on rooted Mytouch 3G running Cyanogen 6.

Please provide any additional information below.

http://code.google.com/p/android-scripting/issues/detail?can=1&q=354&colspec=ID%
20Type%20Status%20Priority%20Milestone%20Owner%20Summary%20Stars&id=354#c16

Original issue reported on code.google.com by natural....@gmail.com on 7 Aug 2010 at 11:57

GoogleCodeExporter commented 9 years ago
I can't reproduce this error. Could you provide a logcat output? Also, please 
provide the script your tried to run. Also, try uninstalling BeanShell, 
deleting all .zip files from your SD card, and reinstalling it. It's possible 
you're getting an old version...

Original comment by damonkoh...@gmail.com on 7 Aug 2010 at 1:27

GoogleCodeExporter commented 9 years ago
Sorry this took so long -- had to work the day job today. :P

OK, since I am running rooted, and since this seems to be a file permissions 
problem -- apparently the dalvik-cache stuff -- I first made sure Terminal 
didn't have 'su' permissions, I turned off Swapper2, I manually deleted (as 
requested) all .zip files from my /sdcard, I uninstalled Beanshell, Rhino, and 
SL4A (in that order).

Then I rebooted and re-installed SL4A and Rhino.

Output from file listing run in adb shell:

# find / -name '*rhino*' -exec ls -l {} \;
----rwxr-x    1 system   sdcard_r     31884 Aug  7 23:05 
/mnt/sdcard/download/rhino_for_android_r0.apk
d---rwxr-x    2 system   sdcard_r      8192 Aug  7 23:06 dalvik-cache
d---rwxr-x    3 system   sdcard_r      8192 Aug  7 23:06 extras
----rwxr-x    1 system   sdcard_r    352699 Aug  7 23:06 rhino_extras_r3.zip
----rwxr-x    1 system   sdcard_r       268 Aug  7 23:06 rhino_scripts_r2.zip
----rwxr-x    1 system   sdcard_r    352699 Aug  7 23:06 
/mnt/sdcard/com.googlecode.rhinoforandroid/rhino_extras_r3.zip
----rwxr-x    1 system   sdcard_r      1933 Aug  7 23:06 android.js
----rwxr-x    1 system   sdcard_r     17347 Aug  7 23:06 json2.js
----rwxr-x    1 system   sdcard_r    347018 Aug  7 23:06 rhino1_7R2-dex.jar
----rwxr-x    1 system   sdcard_r    347018 Aug  7 23:06 
/mnt/sdcard/com.googlecode.rhinoforandroid/extras/rhino/rhino1_7R2-dex.jar
----rwxr-x    1 system   sdcard_r       268 Aug  7 23:06 
/mnt/sdcard/com.googlecode.rhinoforandroid/rhino_scripts_r2.zip
-rw-r--r--    1 system   system       31884 Aug  7 23:06 
/data/app/com.googlecode.rhinoforandroid-1.apk
drwxr-xr-x    1 system   system        2048 Aug  7 23:06 lib
drwxrwx--x    1 app_80   app_80        2048 Aug  7 23:06 shared_prefs
-rw-rw----    1 app_80   app_80         129 Aug  7 23:06 
/data/data/com.googlecode.rhinoforandroid/shared_prefs/com.googlecode.rhinoforan
droid_preferences.xml
-rw-r--r--    1 system   app_80       56344 Aug  7 23:06 
/data/dalvik-cache/data@app@com.googlecode.rhinoforandroid-1.apk@classes.dex

The script I tried to run is:

# cat hello_world.js
load("/sdcard/com.googlecode.rhinoforandroid/extras/rhino/android.js");
var droid = new Android();
droid.makeToast("Hello, Android!");

Logcat:

V/sl4a.JsonRpcServer:270( 1289): Bound to 127.0.0.1:53899
I/ActivityManager(  117): Starting activity: Intent { flg=0x10000000 
cmp=com.googlecode.android_scripting/.terminal.Terminal (has extras) }
V/sl4a.Process:122( 1289): Executing /system/bin/dalvikvm with arguments 
[-Xbootclasspath:/system/framework/core.jar, -Xss128k, -classpath, 
/mnt/sdcard/com.googlecode.rhinoforandroid/extras/rhino/rhino1_7R2-dex.jar, 
org.mozilla.javascript.tools.shell.Main, -O, -1, 
/mnt/sdcard/sl4a/scripts/hello_world.js] and with environment 
{ANDROID_SOCKET_zygote=11, AP_HANDSHAKE=955ccf1d-44eb-4174-9e0c-2684ac0eaead, 
ANDROID_BOOTLOGO=1, EXTERNAL_STORAGE=/mnt/sdcard, ANDROID_CACHE=/cache, 
ANDROID_ASSETS=/system/app, PATH=/sbin:/system/sbin:/system/bin:/system/xbin, 
ASEC_MOUNTPOINT=/mnt/asec, AP_HOST=localhost, 
BOOTCLASSPATH=/system/framework/core.jar:/system/framework/ext.jar:/system/frame
work/framework.jar:/system/framework/android.policy.jar:/system/framework/servic
es.jar, AP_PORT=53899, TERMINFO=/system/etc/terminfo, 
ANDROID_DATA=/mnt/sdcard/com.googlecode.rhinoforandroid, 
LD_LIBRARY_PATH=/system/lib, ANDROID_ROOT=/system, 
ANDROID_PROPERTY_WORKSPACE=10,32768}
I/ActivityManager(  117): Start proc com.google.android.voicesearch for 
broadcast com.google.android.voicesearch/.logging.LoggingReceiver: pid=1435 
uid=10004 gids={3003}
D/dalvikvm( 1289): GC_FOR_MALLOC freed 7103 objects / 561976 bytes in 486ms
I/ActivityThread( 1435): Publishing provider 
com.google.android.voicesearch.VoiceSearchResultProvider: 
com.google.android.voicesearch.VoiceSearchResultProvider
I/dalvikvm-heap( 1289): Grow heap (frag case) to 4.474MB for 1600016-byte 
allocation
D/dalvikvm( 1289): GC_FOR_MALLOC freed 740 objects / 38256 bytes in 289ms
I/ActivityManager(  117): Displayed activity 
com.googlecode.android_scripting/.terminal.Terminal: 1592 ms (total 1592 ms)
E/dalvikvm( 1432): Can't open dex cache 
'/data/dalvik-cache/mnt@sdcard@com.googlecode.rhinoforandroid@extras@rhino@rhino
1_7R2-dex.jar@classes.dex': No such file or directory
I/dalvikvm( 1432): Unable to open or create cache for 
/mnt/sdcard/com.googlecode.rhinoforandroid/extras/rhino/rhino1_7R2-dex.jar 
(/data/dalvik-cache/mnt@sdcard@com.googlecode.rhinoforandroid@extras@rhino@rhino
1_7R2-dex.jar@classes.dex)
W/dalvikvm( 1432): threadid=1: thread exiting with uncaught exception 
(group=0x400205c8)
V/sl4a.Process$1:136( 1289): Process 1432 exited with result code 1.
D/dalvikvm( 1289): GC_FOR_MALLOC freed 2518 objects / 573704 bytes in 105ms
E/sl4a.EmulatorView$2:415( 1289): Failed to read. Exiting thread.
E/sl4a.EmulatorView$2:415( 1289): java.io.IOException: I/O error
E/sl4a.EmulatorView$2:415( 1289):   at 
org.apache.harmony.luni.platform.OSFileSystem.readImpl(Native Method)
E/sl4a.EmulatorView$2:415( 1289):   at 
org.apache.harmony.luni.platform.OSFileSystem.read(OSFileSystem.java:118)
E/sl4a.EmulatorView$2:415( 1289):   at 
java.io.FileInputStream.read(FileInputStream.java:312)
E/sl4a.EmulatorView$2:415( 1289):   at 
java.io.FileInputStream.read(FileInputStream.java:267)
E/sl4a.EmulatorView$2:415( 1289):   at 
com.trilead.ssh2.StreamGobbler$GobblerThread.run(StreamGobbler.java:40)

I'm a little curious why there is a (very) recent file called 
'/data/dalvik-cache/data@app@com.googlecode.rhinoforandroid-1.apk@classes.dex', 
but the logcat shows 
'/data/dalvik-cache/mnt@sdcard@com.googlecode.rhinoforandroid@extras@rhino@rhino
1_7R2-dex.jar@classes.dex'.

I dunno.  I just installed an app called 'aLogcat', and its running just fine.  
All my apps installed after rooting seem to be fine, and their .dex files seem 
to be in /data/dalvik-cache (as they are supposed to be, I think?).

HTH!

Original comment by natural....@gmail.com on 8 Aug 2010 at 9:50

GoogleCodeExporter commented 9 years ago
Ah, lemme guess: 
'/data/dalvik-cache/data@app@com.googlecode.rhinoforandroid-1.apk@classes.dex' 
are the installer classes, etc., whereas the (apparentl non-existent) 
'/data/dalvik-cache/mnt@sdcard@com.googlecode.rhinoforandroid@extras@rhino@rhino
1_7R2-dex.jar@classes.dex' are supposed to be the actual rhino runtime.

Original comment by natural....@gmail.com on 8 Aug 2010 at 9:56

GoogleCodeExporter commented 9 years ago
Looks like it's Cyanogen specific issue. Apparently, setting ANDROID_DATA to 
'/mnt/sdcard/com.googlecode.rhinoforandroid' does not really work there. We'll 
try to find a way around.

Original comment by Alexey.R...@gmail.com on 10 Aug 2010 at 11:22

GoogleCodeExporter commented 9 years ago
I was wondering about that. ('ANDROID_DATA') 

To me, it looks like an environment variable?  I'm too new to Android to be 
sure, and if it is, if/how one could set it from within SL4A, or I would have 
already tried.

Thanks for looking at this.

Original comment by natural....@gmail.com on 11 Aug 2010 at 4:44

GoogleCodeExporter commented 9 years ago
Interestingly (to me anyway), after a fresh reboot when I connect via 'adb 
shell', the environment is a bit different:

# set
ANDROID_ASSETS=/system/app
ANDROID_BOOTLOGO=1
ANDROID_CACHE=/cache
ANDROID_DATA=/data
ANDROID_PROPERTY_WORKSPACE=10,32768
ANDROID_ROOT=/system
ASEC_MOUNTPOINT=/mnt/asec
BOOTCLASSPATH=/system/framework/core.jar:/system/framework/ext.jar:/system/frame
work/framework.jar:/system/framework/android.policy.jar:/system/framework/servic
es.jar
EXTERNAL_STORAGE=/mnt/sdcard
IFS='   
'
LD_LIBRARY_PATH=/system/lib
OPTIND=1
PATH=/sbin:/system/sbin:/system/bin:/system/xbin
PS1='# '
PS2='> '
PS4='+ '
TERMINFO=/system/etc/terminfo
#

So I wonder why ANDROID_DATA is changed?

Original comment by natural....@gmail.com on 14 Aug 2010 at 12:03

GoogleCodeExporter commented 9 years ago
Any movement on this issue? I am dying to try this, but have same problem 
(Cyanogen 6 RC3 for Moto Droid).

Thanks!

Original comment by jason.bunting on 25 Aug 2010 at 11:17

GoogleCodeExporter commented 9 years ago
Please try with the just release SL4A r1. However, I suspect this is an issue 
with Cyanogen.

Original comment by damonkoh...@gmail.com on 25 Aug 2010 at 11:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
when starting a jruby script i get
Dalvik VM unable to locate class 'org/jruby/Main'
java.lang.NoCassDefFoundError: org.jruby.Main
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: org.jruby.Main in loader 
dalvik.system.PathClassLoader[/mnt/cdcard/com.googlecode.jrubyforandroid/extras/
jruby/jruby-complete-1.4.jar]
    at dalvik.system.PathlassLoader.findClass(PathClassLoader.jave:243)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:573)

Original comment by philipp....@gmail.com on 5 Sep 2010 at 11:16

GoogleCodeExporter commented 9 years ago
Just wanted to tell, i installed Pays ROM on the desire, got it from here:
http://forum.xda-developers.com/showthread.php?t=729172
Everything works now as it should!

Original comment by philipp....@gmail.com on 7 Sep 2010 at 12:19

GoogleCodeExporter commented 9 years ago

Original comment by damonkoh...@gmail.com on 9 Sep 2010 at 11:45

GoogleCodeExporter commented 9 years ago

Original comment by damonkoh...@gmail.com on 6 Nov 2010 at 9:22

GoogleCodeExporter commented 9 years ago
@ Cyanogen Mod 6

File permissions are too strict. Got mine working.

/cache
/cache/dalvik-cache
/data
/data/dalvik-cache

These dir permissions don't have 'other/world' r/w which causes failure to load 
class data's.

Original comment by pc.wiz...@gmail.com on 7 Mar 2011 at 7:56

GoogleCodeExporter commented 9 years ago
This is actually android issue 966

http://code.google.com/p/android/issues/detail?id=966

I'm trying to figure out how to install jar files using an apk. It may be 
pointless. It seems like google doesn't want us to have our own "user library 
cache" (eg. /usr/lib/dalvik-cache". Which is unacceptable to me as a developer. 
I can understand why for "system files" because it is a security risk, but for 
an application library? This does not support code reuse or application 
extensibility which is "supposedly" one of the goals of the android platform. 
There needs to be a permission system created for applications that would give 
each application a user name on the system which would then delegate access to 
the libraries in the user cache by proxy. That's just my take on the 
sit-chee-ation.

Original comment by pc.wiz...@gmail.com on 25 Mar 2011 at 6:11

GoogleCodeExporter commented 9 years ago
I solved this.
1)open this file: 
/mnt/sdcard/com.googlecode.rhinoforandroid/extras/rhino/rhino1_7R2-dex.jar
2)extract the file classes.dex to /data/dalvik-cache/
3)change the file permission of classes.dex to rw-r--r--
4)change the owner of classes.dex to 1000 (system)
5)change the group of classes.dex to 1000 (system) or 2000 (shell)
6)change the name of classes.dex to 
mnt@sdcard@com.googlecode.rhinoforandroid@extras@rhino@rhino1_7R2-dex.jar@classe
s.dex

Original comment by foxwi...@gmail.com on 29 Oct 2011 at 12:01