我在Android本机库中进行了更改并安装了新的system.img文件,但现在在启动时遇到了无关的错误。我可以通过吞下错误来解决它,但我想知道是否有人可以解释问题是什么。
The Android implementation of Logger.java claims强制LogManager初始化,因为它的类初始化代码执行必要的一次性设置。但这种强制初始化会导致NoClassDefFoundError。我认为它与尚未被Zygote预装的类有关,但对整个类加载器和VM业务并不熟悉。
如果有人有一些见解,将不胜感激。感谢。
I/Zygote ( 1253): Preloading classes...
D/skia ( 1253): ------ build_power_table 1.4
D/skia ( 1253): ------ build_power_table 0.714286
W/dalvikvm( 1253): Exception Ljava/lang/StackOverflowError; thrown during Ljava/util/logging/LogManager;.<clinit>
W/dalvikvm( 1253): Exception Ljava/lang/NoClassDefFoundError; thrown during Ljava/security/Security;.<clinit>
W/dalvikvm( 1253): Exception Ljava/lang/ExceptionInInitializerError; thrown during Landroid/net/http/HttpsConnection;.<clinit>
E/Zygote ( 1253): Error preloading android.net.http.HttpsConnection.
E/Zygote ( 1253): java.lang.ExceptionInInitializerError
E/Zygote ( 1253): at java.lang.Class.classForName(Native Method)
E/Zygote ( 1253): at java.lang.Class.forName(Class.java:237)
E/Zygote ( 1253): at java.lang.Class.forName(Class.java:183)
E/Zygote ( 1253): at com.android.internal.os.ZygoteInit.preloadClasses(ZygoteInit.java:295)
E/Zygote ( 1253): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
E/Zygote ( 1253): at dalvik.system.NativeStart.main(Native Method)
E/Zygote ( 1253): Caused by: java.lang.ExceptionInInitializerError
E/Zygote ( 1253): at javax.net.ssl.KeyManagerFactory$1.run(KeyManagerFactory.java:57)
E/Zygote ( 1253): at javax.net.ssl.KeyManagerFactory$1.run(KeyManagerFactory.java:56)
E/Zygote ( 1253): at java.security.AccessController.doPrivilegedImpl(AccessController.java:264)
E/Zygote ( 1253): at java.security.AccessController.doPrivileged(AccessController.java:84)
E/Zygote ( 1253): at javax.net.ssl.KeyManagerFactory.getDefaultAlgorithm(KeyManagerFactory.java:55)
E/Zygote ( 1253): at org.apache.harmony.xnet.provider.jsse.SSLParameters.(SSLParameters.java:142)
E/Zygote ( 1253): at org.apache.harmony.xnet.provider.jsse.SSLContextImpl.engineInit(SSLContextImpl.java:82)
E/Zygote ( 1253): at android.net.http.HttpsConnection.initializeEngine(HttpsConnection.java:101)
E/Zygote ( 1253): at android.net.http.HttpsConnection.(HttpsConnection.java:65)
E/Zygote ( 1253): ... 6 more
E/Zygote ( 1253): Caused by: java.lang.NoClassDefFoundError: java.util.logging.LogManager
E/Zygote ( 1253): at java.util.logging.Logger.initHandler(Logger.java:419)
E/Zygote ( 1253): at java.util.logging.Logger.log(Logger.java:1094)
E/Zygote ( 1253): at java.util.logging.Logger.warning(Logger.java:906)
E/Zygote ( 1253): at org.apache.harmony.luni.util.MsgHelp.loadBundle(MsgHelp.java:61)
E/Zygote ( 1253): at org.apache.harmony.luni.util.Msg.getString(Msg.java:60)
E/Zygote ( 1253): at java.io.BufferedInputStream.read(BufferedInputStream.java:316)
E/Zygote ( 1253): at java.io.FilterInputStream.read(FilterInputStream.java:138)
E/Zygote ( 1253): at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:157)
E/Zygote ( 1253): at java.io.BufferedInputStream.read(BufferedInputStream.java:243)
E/Zygote ( 1253): at java.util.Properties.load(Properties.java:302)
E/Zygote ( 1253): at java.security.Security$1.run(Security.java:80)
E/Zygote ( 1253): at java.security.Security$1.run(Security.java:67)
E/Zygote ( 1253): at java.security.AccessController.doPrivilegedImpl(AccessController.java:264)
E/Zygote ( 1253): at java.security.AccessController.doPrivileged(AccessController.java:84)
E/Zygote ( 1253): at java.security.Security.(Security.java:66)
E/Zygote ( 1253): ... 15 more
W/dalvikvm( 1253): threadid=3: thread exiting with uncaught exception (group=0x2aac6170)
答案 0 :(得分:1)
我认为关键是这一行:
W / dalvikvm(1253):异常Ljava / lang / StackOverflowError;在Ljava / util / logging / LogManager;。
期间抛出我的猜测是该行末尾有一个<clinit>
HTML转换吞噬了。消息是说,在LogManager类的类初始化期间,存在StackOverflowError。这导致课程不可用。稍后,当调用Logger.initHandler()时,系统返回NoClassDefFoundError。
因此,要弄清楚发生了什么,你需要掌握StackOverflowError。
答案 1 :(得分:0)
尝试从frameworks / base / preloaded-classes中删除有问题的类,然后重新构建框架,并刷新设备。如果从android.net.http中删除所有日志记录类和类,那么你将获得最大的成功机会。
这可能会对微小性能产生影响,因为删除的类不会在应用程序之间共享。
答案 2 :(得分:0)
正如fadden所指出的那样,在LogManager的类初始化过程中,类加载器运行了一些其他具有stackoverflow的代码,因此LogManager的类初始化失败。
我不知道你在android调试环境中有什么工具可用,但我会: