简体   繁体   English

RootTools在JavaCommandCapture中引发的ClassNotFoundException

[英]ClassNotFoundException thrown by RootTools in JavaCommandCapture

I followed the directions on the RootTools usage and run Java as root wiki pages, but when I load my app with the following in onCreate() I get a ClassNotFoundException: com.stericson.RootTools.containers.RootClass: 我按照RootTools 用法上的说明进行操作,并以root Wiki页面的形式运行Java ,但是当我在onCreate()中使用以下内容加载我的应用程序时,出现ClassNotFoundException:com.stericson.RootTools.containers.RootClass:

import com.stericson.RootTools.RootTools;
import com.stericson.RootTools.containers.RootClass;
import com.stericson.RootTools.exceptions.RootDeniedException;
import com.stericson.RootTools.execution.CommandCapture;
import com.stericson.RootTools.execution.JavaCommandCapture;
import com.stericson.RootTools.execution.Shell;
...
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    RootTools.debugMode = true; //ON
    RootTools.log("roottools is logging");
    RootTools.handlerEnabled = false;

    Shell shell;
    try {
        shell = RootTools.getShell(true);
        JavaCommandCapture cmd = new JavaCommandCapture(
                43,
                false,
                this,
                "com.mycompany.TestActivity.RootToolsTest") {

            @Override
            public void commandOutput(int id, String line) {
                super.commandOutput(id, line);

            }
        };
        shell.add(cmd);
    } catch (Exception e) {
        e.printStackTrace();
    }
...
@RootClass.Candidate
private class RootToolsTest{
    public RootToolsTest(){
        Log.d("RootToolsTest", "testing a Java class run as root");
    }
}

The same thing happened when I tried RootTools' test class com.stericson.RootToolsTests.NativeJavaClass. 当我尝试RootTools的测试类com.stericson.RootToolsTests.NativeJavaClass时,发生了同样的事情。 I've tried a number of configurations for the placement and inclusion of the RootTools.jar file (most notably ensuring that the RootTools jar is checked for export and moved to the top of the order and export list in Eclipse) but the ClassNotFoundException persists. 我已经尝试了许多配置来放置和包含RootTools.jar文件(最著名的是确保检查了RootTools jar并导出到Eclipse中的顺序和导出列表的顶部),但ClassNotFoundException仍然存在。 The exact logcat output follows: 准确的logcat输出如下:

06-02 07:27:45.529: D/RootTools v3.4(5165): roottools is logging
06-02 07:27:45.529: D/RootTools v3.4(5165): Starting Root Shell!
06-02 07:27:45.539: D/RootTools v3.4(5165): Starting shell: su
06-02 07:27:46.409: D/RootTools v3.4(5165): CommandHandler not created
06-02 07:27:46.429: D/RootTools v3.4(5165): Executing: dalvikvm -cp /data/data
/com.hdradio.fmdelverrooted/files/anbuild.dex com.android.internal.util.WithFramework 
com.stericson.RootTools.containers.RootClass 
com.hdradio.fmdelver.core.DelverActivity.RootToolsTest
06-02 07:27:46.749: D/Command(5165): ID: 43, java.lang.ClassNotFoundException: 
com.stericson.RootTools.containers.RootClass
06-02 07:27:46.759: D/Command(5165): ID: 43,at java.lang.Class.classForName(Native Method)
06-02 07:27:46.759: D/Command(5165): ID: 43,at java.lang.Class.forName(Class.java:217)
06-02 07:27:46.759: D/Command(5165): ID: 43,at java.lang.Class.forName(Class.java:172)
06-02 07:27:46.769: D/Command(5165): ID: 43,at 
com.android.internal.util.WithFramework.main(WithFramework.java:36)
06-02 07:27:46.769: D/Command(5165): ID: 43,at dalvik.system.NativeStart.main(Native 
Method)
06-02 07:27:46.769: D/Command(5165): ID: 43, Caused by: java.lang.NoClassDefFoundError: 
com/stericson/RootTools/containers/RootClass
06-02 07:27:46.769: D/Command(5165): ID: 43,    ... 5 more
06-02 07:27:46.769: D/Command(5165): ID: 43, Caused by: java.lang.ClassNotFoundException: 
com.stericson.RootTools.containers.RootClass
06-02 07:27:46.769: D/Command(5165): ID: 43,at 
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-02 07:27:46.769: D/Command(5165): ID: 43,at 
java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-02 07:27:46.769: D/Command(5165): ID: 43,    at 
java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-02 07:27:46.769: D/Command(5165): ID: 43,    ... 5 more
06-02 07:27:46.979: D/RootTools v3.4(5165): Command 43 finished.

My .classpath looks like: 我的.classpath看起来像:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="/Users/myhome/devel_resources
/code/RootTools/RootTools-3.4.jar"/>
    <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" 
path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" 
path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

My development system configuration is as follows: OS: Mac OS X 10.9.2 Eclipse: Kepler ADT: 22.3 RootTools Version: 3.4 我的开发系统配置如下:OS:Mac OS X 10.9.2 Eclipse:Kepler ADT:22.3 RootTools版本:3.4

and my target platform: Android: 4.1.1 Model: Sony Xperia E C1504 (rooted using SRSRoot and the 'Gandalf' exploit) Firmware: Stock Kernel Xperia E C1505_11.3.A.0.47 (supposed to work for C1504 as well) 我的目标平台:Android:4.1.1型号:Sony Xperia E C1504(使用SRSRoot和'Gandalf'漏洞植根)固件:Stock Kernel Xperia E C1505_11.3.A.0.47(同样适用于C1504)

Any ideas why Android can't find the com.stericson.RootTools.containers.RootClass class? 为什么Android找不到com.stericson.RootTools.containers.RootClass类的任何想法?

Happened to me, the jar file was currupted and the .class file was physically absent. 碰巧的是,jar文件损坏了,而.class文件实际上不存在。 Exactly what the exception is telling you. 确切地讲,异常正在告诉您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM