我想上运行dalvikvm使用的这些说明。我以root身份运行,所以它不是一个权限问题。
下面是应用程序code:
进口android.os.SystemClock;
/ **
*命令发送键事件到设备上,或者通过它们的键code或由
*所需的字符输出。
* /
公共类MWE {
公共静态无效的主要(字串[] args){
的System.out.println(SystemClock.uptimeMillis());
}
}
当我运行这个在dalvikvm,我收到以下错误信息:
java.lang.NoClassDefFoundError的:android.os.SystemClock
在MWE.main(MWE.java:8)
在dalvik.system.NativeStart.main(本机方法)
下面是我执行命令,该命令适用于上述应用程序的正常的Hello World版本。
/系统/斌/ dalvikvm -Xbootclasspath:/system/framework/core.jar -classpath /data/local/tmp/MWE.jar MWE
我目前的结论是, android.os.SystemClock
不活在 core.jar添加
。我曾推测尝试添加 framework.jar
和框架res.jar
为好,但我得到了同样的错误
/系统/框架
根据该罐的持有类 android.os.SystemClock
?
在一般情况下,有没有,有一类到罐子的Android映射部署罐子的地方?
解决方案 在我的设备(的HTC One M8)android.os.SystemClock是/system/framework/framework3.jar。我相信框架分成,因为对classes.dex的65K方法限制多罐。 android.os.SystemClock可能是在不同的瓶子不同的Android设备。
我用步骤来查找android.os.SystemClock位于:
亚行拉/system/framework/<filename>.jar
我再反编译classes.dex到罐 DexToJar 并观看了使用的 JD-GUI (你可以只打开它作为一个ZIP文件,JD-GUI是没有必要的,仅限于Windows)
I am trying to run a simple command line java application on dalvikvm using the these instructions. I am running as root so it is not a permissions issue.
Here is the application code:
import android.os.SystemClock;
/**
* Command that sends key events to the device, either by their keycode, or by
* desired character output.
*/
public class MWE {
public static void main(String[] args) {
System.out.println(SystemClock.uptimeMillis());
}
}
When I run this on dalvikvm, I get the following error message:
java.lang.NoClassDefFoundError: android.os.SystemClock
at MWE.main(MWE.java:8)
at dalvik.system.NativeStart.main(Native Method)
Here is the command that I run, which works for the normal Hello World version of the above application.
/system/bin/dalvikvm -Xbootclasspath:/system/framework/core.jar -classpath /data/local/tmp/MWE.jar MWE
My current conclusion is that android.os.SystemClock
does not live inside core.jar
. I have speculatively tried to add framework.jar
and framework-res.jar
as well, but I get the same error.
/system/framework
holds the class android.os.SystemClock
?
In general, is there a place that has a class-to-jar mapping for deployed jars in Android?
解决方案
On my device (HTC One M8) android.os.SystemClock is in /system/framework/framework3.jar. I believe framework is separated into multiple jars because of the 65k method limit on classes.dex. android.os.SystemClock may be in a different jar on different android devices.
Steps I used to find where android.os.SystemClock was located:
adb pull /system/framework/<filename>.jar
I then decompiled classes.dex to a jar with DexToJar and viewed the packages inside the jar using JD-GUI (you could just open it as a ZIP file, jd-gui is not necessary and for windows only)