4

我有 3 台设备。

1.基于cm9(android 4.0.4)。

2.htcg14(安卓4.0.3)

3.moto me525 基于miui(android 2.2)

他们都扎根了。

我在设备 1 和 3 的终端中执行下面的代码,该过程运行良好。但是设备2,它不起作用。

su
export CLASSPATH=/sdcard/foo.jar
exec app_process /system/bin xx.xx.Test '$@'

日志

W/dalvikvm(12364): Exception Ljava/lang/NullPointerException; thrown while initializing Ljava/lang/System;
W/dalvikvm(12364): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Ljava/lang/ClassLoader$SystemClassLoader;
W/dalvikvm(12364): WARNING: system class loader is NULL (setting main ctxt)
W/dalvikvm(12364): Warning: tracked references remain post-initialization
W/dalvikvm(12364): MAIN reference table (0xf9a388) dump:
W/dalvikvm(12364):   Last 1 entries (of 1):
E/dalvikvm(12364): Class lookup Ljava/lang/Daemons; attempted with exception pending
W/dalvikvm(12364): Pending exception is:
I/dalvikvm(12364): java.lang.ExceptionInInitializerError:
I/dalvikvm(12364):     at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:125)
I/dalvikvm(12364):     at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(12364): Caused by:
I/dalvikvm(12364): java.lang.ExceptionInInitializerError:
I/dalvikvm(12364):     at java.lang.ClassLoader.createSystemClassLoader(ClassLoader.java:100)
I/dalvikvm(12364):     at java.lang.ClassLoader.access$000(ClassLoader.java:65)
I/dalvikvm(12364):     at java.lang.ClassLoader$SystemClassLoader.<clinit>(ClassLoader.java:81)
I/dalvikvm(12364):     at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:125)
I/dalvikvm(12364):     at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(12364): Caused by:
I/dalvikvm(12364): java.lang.NullPointerException:
I/dalvikvm(12364):     at java.util.Hashtable.put(Hashtable.java:365)
I/dalvikvm(12364):     at java.lang.System.initSystemProperties(System.java:286)
I/dalvikvm(12364):     at java.lang.System.getProperties(System.java:260)
I/dalvikvm(12364):     at java.lang.System.getProperty(System.java:425)
I/dalvikvm(12364):     at java.lang.System.getProperty(System.java:406)
I/dalvikvm(12364):     at java.lang.System.<clinit>(System.java:90)
I/dalvikvm(12364):     at java.lang.ClassLoader.createSystemClassLoader(ClassLoader.java:100)
I/dalvikvm(12364):     at java.lang.ClassLoader.access$000(ClassLoader.java:65)
I/dalvikvm(12364):     at java.lang.ClassLoader$SystemClassLoader.<clinit>(ClassLoader.java:81)
I/dalvikvm(12364):     at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:125)
I/dalvikvm(12364):     at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(12364): DALVIK THREADS:
I/dalvikvm(12364): (mutexes: tll=0 tsl=0 tscl=0 ghl=0)
I/dalvikvm(12364): "main" prio=5 tid=1 RUNNABLE
I/dalvikvm(12364):   | group="main" sCount=0 dsCount=0 obj=0x40aa1490 self=0xf99d30
I/dalvikvm(12364):   | sysTid=12364 nice=0 sched=0/0 cgrp=default handle=1074107592
I/dalvikvm(12364):   | schedstat=( 0 0 0 ) utm=18 stm=7 core=0
I/dalvikvm(12364):   at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(12364): 
E/dalvikvm(12364): VM aborting
F/libc    (12364): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1)
I/DEBUG   ( 4218): debuggerd: 2012-08-02 14:29:57
I/DEBUG   ( 4218): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   ( 4218): Build fingerprint: 'htc_asia_tw/htc_pyramid/pyramid:4.0.3/IML74K/391535.6:user/release-keys'
I/DEBUG   ( 4218): pid: 12364, tid: 12364  >>> app_process <<<
I/DEBUG   ( 4218): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d

当我在java中执行这些代码时,设备1和2不起作用。他们有同样的错误。关于设备3,我不知道结果,因为有人拿回了他的设备。

帮助!有什么想法吗?

4

1 回答 1

7

似乎在启动 dalvikvm 时,您的LD_LIBRARY_PATH未在环境中正确设置。在 ICS & JB 中,dalvikvm 需要LD_LIBRARY_PATH才能在其中包含特定路径。默认值为/vendor/lib:/system/lib,尽管通常/system/lib就足够了。否则你会看到异常。

您可以尝试在脚本中export LD_LIBRARY_PATH=/vendor/lib:/system/lib的命令之后添加。su

如果您的 euid 与您的 uid 不匹配,则可能会从环境中删除LD_LIBRARY_PATH 。您可以使用idand id -raftersu检查它们是否匹配。您还可以检查是否/system/bin/mksh已设置,因为这也可能导致问题。

于 2012-08-08T03:58:38.753 回答