RootTools
RootTools copied to clipboard
ClassNotFoundException thrown when executing a JavaCommandCapture command
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:
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. 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. The exact logcat output follows:
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:
My development system configuration is as follows: OS: Mac OS X 10.9.2 Eclipse: Kepler ADT: 22.3 RootTools Version: 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)
Any ideas why Android can't find the com.stericson.RootTools.containers.RootClass class?
Hello,
try following these steps:
In Eclipse, right click your project, navigate to "Build Path", then to "configure build path" Now choose "add External Jar" Navigate to the RootToolshttps://code.google.com/p/roottools/wiki/RootTools .jar file you download and choose it. Navigate to "Order and Export" make sure the box is ticked next to the library, and move it to the top of the list. Finish up by choosing "ok"
On Thu, Feb 27, 2014 at 5:12 PM, Jeff Creswell [email protected]:
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:
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 https://github.com/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. 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. The exact logcat output follows:
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:
path="com.android.ide.eclipse.adt.LIBRARIES"/> path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
My development system configuration is as follows: OS: Mac OS X 10.9.2 Eclipse: Kepler ADT: 22.3
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)
Any ideas why Android can't find the com.stericson.RootTools.containers.RootClass class?
Reply to this email directly or view it on GitHubhttps://github.com/Stericson/RootTools/issues/2 .
Hi Stephen, I tried your steps above, but the result was the same-- ClassNotFoundException for com.stericson.RootTools.containers.RootClass thanks, ccj
could something going wrong during the construction of anbuild.dex cause this error? I've cleaned the project, removed the old anbuild.dex, rebuilt the project and then anbuild.dex, and re-installed the app but the ClassNotFoundException persists. How can I verify that the contents of anbuild.dex are correct?
sidenote: OSX creates .DS_Store files in any directory Finder has entered to keep track of metadata for the GUI; if an OSX user has entered $ANDROID_HOME/build-tools with Finder the .DS_Store file will screw up the execution of com.stericson.RootTools.containers.RootClass in the method getPathToDx() which assumes that only relevant SDK version directories will be present. Specifically, a NumberFormatException is thrown from Integer.parseInt("") because split(".") executed on .DS_Store returns the empty string to index 0 of the resultant String array. A workaround is for the user to ensure only relevant SDK version directories are present in build-tools, but some extra validation in RootClass might be handy. Thanks!
Can there be more than one @RootClass.candidate annotated class in an app using JavaCommandCapture? I looked at the dexdump of my anbuild.dex and I only saw instances of com.stericson.RootTools.containers.RootClass associated with one of my annotations, and not the one I was currently testing in the app which winds up throwing ClassNotFoundException for RootClass
Hi sorry for only realizing now that we had an issue thread open here.
You can use the candidate annotation with multiple classes and they should all end up in the dex file.
OK the parseInt() error is goofy I'll fix that (unless Stephen gets around to doing it first)
Note that the code you posted is about a private class. This is not a class that can ever be invoked by anyone.
BTW, beyond the wiki documentation, you can look into a real application: https://github.com/Fusion/BambooGarden
In JavaCommandCapture's constructor parameters, what is the significance of the id argument?
I tried including the RootTools source code with my app build, but the result is the same as above. Below follows the unfiltered logcat history around when I use JavaCommandCapture: [CODE] 03-06 15:39:53.969: D/RootTools v3.4(3261): roottools is logging 03-06 15:39:53.969: D/RootTools v3.4(3261): Starting Root Shell! 03-06 15:39:53.969: D/RootTools v3.4(3261): Starting shell: su 03-06 15:39:54.019: E/su(3275): sudb - Opening database 03-06 15:39:54.019: E/su(3275): sudb - Database opened 03-06 15:39:54.029: E/su(3275): sudb - Database closed 03-06 15:39:54.519: D/dalvikvm(3278): GC_CONCURRENT freed 103K, 80% free 513K/2560K, paused 0ms+3ms, total 11ms 03-06 15:39:54.529: W/LocaleUtil(3058): locale = en_US 03-06 15:39:54.529: W/LocaleUtil(3058): scriptSubtag = Latn 03-06 15:39:54.749: D/su(3275): 10140 com.mycompany.fmdelverrooted executing 0 /system/bin/sh using shell /system/bin/sh : sh 03-06 15:39:54.759: D/RootTools v3.4(3261): CommandHandler not created 03-06 15:39:54.779: D/RootTools v3.4(3261): Executing: dalvikvm -cp /data/data/com.mycompany.fmdelverrooted/files/anbuild.dex com.android.internal.util.WithFramework com.stericson.RootTools.containers.RootClass com.mycompany.fmdelver.core.DelverActivity.RootToolsTest 03-06 15:39:54.979: I/Adreno200-EGL(3261): <qeglDrvAPI_eglInitialize:299>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_REL_RB1.04.01.01.06.043_msm7627a_JB_REL_RB1.2_Merge_release_AU (Merge) 03-06 15:39:54.979: I/Adreno200-EGL(3261): Build Date: 02/07/13 Thu 03-06 15:39:54.979: I/Adreno200-EGL(3261): Local Branch: 03-06 15:39:54.979: I/Adreno200-EGL(3261): Remote Branch: m/jb_rel_rb1.2 03-06 15:39:54.979: I/Adreno200-EGL(3261): Local Patches: NONE 03-06 15:39:54.979: I/Adreno200-EGL(3261): Reconstruct Branch: NOTHING 03-06 15:39:55.129: W/dalvikvm(3296): threadid=1: thread exiting with uncaught exception (group=0x40a09498) 03-06 15:39:55.149: D/Command(3261): ID: 1, java.lang.ClassNotFoundException: com.stericson.RootTools.containers.RootClass 03-06 15:39:55.149: D/Command(3261): ID: 1, at java.lang.Class.classForName(Native Method) 03-06 15:39:55.149: D/Command(3261): ID: 1, at java.lang.Class.forName(Class.java:217) 03-06 15:39:55.149: D/Command(3261): ID: 1, at java.lang.Class.forName(Class.java:172) 03-06 15:39:55.149: D/Command(3261): ID: 1, at com.android.internal.util.WithFramework.main(WithFramework.java:36) 03-06 15:39:55.149: D/Command(3261): ID: 1, at dalvik.system.NativeStart.main(Native Method) 03-06 15:39:55.149: D/Command(3261): ID: 1, Caused by: java.lang.NoClassDefFoundError: com/stericson/RootTools/containers/RootClass 03-06 15:39:55.149: D/Command(3261): ID: 1, ... 5 more 03-06 15:39:55.149: D/Command(3261): ID: 1, Caused by: java.lang.ClassNotFoundException: com.stericson.RootTools.containers.RootClass 03-06 15:39:55.149: D/Command(3261): ID: 1, at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 03-06 15:39:55.159: D/Command(3261): ID: 1, at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 03-06 15:39:55.159: D/Command(3261): ID: 1, at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 03-06 15:39:55.159: D/Command(3261): ID: 1, ... 5 more 03-06 15:39:55.159: D/dalvikvm(3296): GC_CONCURRENT freed 17K, 90% free 106K/1024K, paused 0ms+1ms, total 1ms 03-06 15:39:55.239: I/ActivityManager(393): Displayed com.mycompany.fmdelverrooted/com.mycompany.fmdelver.core.DelverActivity: +1s450ms 03-06 15:39:55.399: D/RootTools v3.4(3261): Command 1 finished.
[/CODE]
Interestingly, since I had to re-root my phone for unrelated reasons and SuperUser had to rewrite its white-list, I got to see that the SuperUser prompt for root permissions does rise for the user to accept or decline when my app tries to use JavaCommandCapture. After pressing 'accept' and seeing the '
and here is the dexdump content of my anbuild.dex file:
[CODE]
Processing './anbuild.dex'...
Opened './anbuild.dex', DEX version '035'
Class #0 -
Class descriptor : 'Lcom/mycompany/fmdelver/core/DelverActivity$1;'
Access flags : 0x0000 ()
Superclass : 'Lcom/stericson/RootTools/execution/JavaCommandCapture;'
Interfaces -
Static fields -
Instance fields -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$1;)
name : 'this$0'
type : 'Lcom/mycompany/fmdelver/core/DelverActivity;'
access : 0x1010 (FINAL SYNTHETIC)
Direct methods -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$1;)
name : '
Class #1 -
Class descriptor : 'Lcom/mycompany/fmdelver/core/DelverActivity$2;'
Access flags : 0x0000 ()
Superclass : 'Ljava/lang/Object;'
Interfaces -
#0 : 'Ljava/lang/Thread$UncaughtExceptionHandler;'
Static fields -
Instance fields -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$2;)
name : 'this$0'
type : 'Lcom/mycompany/fmdelver/core/DelverActivity;'
access : 0x1010 (FINAL SYNTHETIC)
#1 : (in Lcom/mycompany/fmdelver/core/DelverActivity$2;)
name : 'val$subclass'
type : 'Ljava/lang/Thread$UncaughtExceptionHandler;'
access : 0x1012 (PRIVATE FINAL SYNTHETIC)
Direct methods -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$2;)
name : '
Class #2 -
Class descriptor : 'Lcom/mycompany/fmdelver/core/DelverActivity$3;'
Access flags : 0x0000 ()
Superclass : 'Ljava/lang/Object;'
Interfaces -
#0 : 'Landroid/view/View$OnClickListener;'
Static fields -
Instance fields -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$3;)
name : 'this$0'
type : 'Lcom/mycompany/fmdelver/core/DelverActivity;'
access : 0x1010 (FINAL SYNTHETIC)
Direct methods -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$3;)
name : '
Class #3 -
Class descriptor : 'Lcom/mycompany/fmdelver/core/DelverActivity$4;'
Access flags : 0x0000 ()
Superclass : 'Ljava/lang/Object;'
Interfaces -
#0 : 'Landroid/view/View$OnClickListener;'
Static fields -
Instance fields -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$4;)
name : 'this$0'
type : 'Lcom/mycompany/fmdelver/core/DelverActivity;'
access : 0x1010 (FINAL SYNTHETIC)
Direct methods -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$4;)
name : '
Class #4 -
Class descriptor : 'Lcom/mycompany/fmdelver/core/DelverActivity$5;'
Access flags : 0x0000 ()
Superclass : 'Ljava/lang/Object;'
Interfaces -
#0 : 'Landroid/view/View$OnClickListener;'
Static fields -
Instance fields -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$5;)
name : 'this$0'
type : 'Lcom/mycompany/fmdelver/core/DelverActivity;'
access : 0x1010 (FINAL SYNTHETIC)
Direct methods -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$5;)
name : '
Class #5 -
Class descriptor : 'Lcom/mycompany/fmdelver/core/DelverActivity$6;'
Access flags : 0x0000 ()
Superclass : 'Ljava/lang/Object;'
Interfaces -
#0 : 'Landroid/view/View$OnClickListener;'
Static fields -
Instance fields -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$6;)
name : 'this$0'
type : 'Lcom/mycompany/fmdelver/core/DelverActivity;'
access : 0x1010 (FINAL SYNTHETIC)
Direct methods -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$6;)
name : '
Class #6 -
Class descriptor : 'Lcom/mycompany/fmdelver/core/DelverActivity$7;'
Access flags : 0x0000 ()
Superclass : 'Ljava/lang/Object;'
Interfaces -
#0 : 'Landroid/view/View$OnClickListener;'
Static fields -
Instance fields -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$7;)
name : 'this$0'
type : 'Lcom/mycompany/fmdelver/core/DelverActivity;'
access : 0x1010 (FINAL SYNTHETIC)
Direct methods -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$7;)
name : '
Class #7 -
Class descriptor : 'Lcom/mycompany/fmdelver/core/DelverActivity$8;'
Access flags : 0x0000 ()
Superclass : 'Ljava/lang/Object;'
Interfaces -
#0 : 'Landroid/view/View$OnClickListener;'
Static fields -
Instance fields -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$8;)
name : 'this$0'
type : 'Lcom/mycompany/fmdelver/core/DelverActivity;'
access : 0x1010 (FINAL SYNTHETIC)
Direct methods -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$8;)
name : '
Class #8 -
Class descriptor : 'Lcom/mycompany/fmdelver/core/DelverActivity$RootToolsTest;'
Access flags : 0x0000 ()
Superclass : 'Ljava/lang/Object;'
Interfaces -
Static fields -
Instance fields -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$RootToolsTest;)
name : 'this$0'
type : 'Lcom/mycompany/fmdelver/core/DelverActivity;'
access : 0x1010 (FINAL SYNTHETIC)
Direct methods -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity$RootToolsTest;)
name : '
Class #9 -
Class descriptor : 'Lcom/mycompany/fmdelver/core/DelverActivity;'
Access flags : 0x0001 (PUBLIC)
Superclass : 'Landroid/app/Activity;'
Interfaces -
Static fields -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : 'ACTION_FM'
type : 'Ljava/lang/String;'
access : 0x0019 (PUBLIC STATIC FINAL)
#1 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : 'ERR_HW'
type : 'I'
access : 0x0019 (PUBLIC STATIC FINAL)
#2 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : 'ERR_LIB_INIT'
type : 'I'
access : 0x0019 (PUBLIC STATIC FINAL)
#3 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : 'ERR_OK'
type : 'I'
access : 0x0019 (PUBLIC STATIC FINAL)
#4 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : 'PLATFORM'
type : 'Ljava/lang/String;'
access : 0x0019 (PUBLIC STATIC FINAL)
#5 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : 'TAG'
type : 'Ljava/lang/String;'
access : 0x0009 (PUBLIC STATIC)
Instance fields -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : 'SUPERUSER_REQUEST'
type : 'I'
access : 0x0012 (PRIVATE FINAL)
#1 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : 'delverLib'
type : 'Lcom/mycompany/fmdelver/nativeinterface/NativeFMDelverLib;'
access : 0x0002 (PRIVATE)
#2 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : 'errorCode'
type : 'I'
access : 0x0002 (PRIVATE)
#3 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : 'libActive'
type : 'I'
access : 0x0002 (PRIVATE)
#4 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : 'mv_oFMReceiver'
type : 'Lcom/mycompany/fmdelver/core/FMReceiver;'
access : 0x0002 (PRIVATE)
#5 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : 'mv_oRootControls'
type : 'Lcom/mycompany/fmdelver/core/RootControls;'
access : 0x0002 (PRIVATE)
Direct methods -
#0 : (in Lcom/mycompany/fmdelver/core/DelverActivity;)
name : '
Class #10 -
Class descriptor : 'Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder$1;'
Access flags : 0x0000 ()
Superclass : 'Ljava/lang/Object;'
Interfaces -
#0 : 'Ljava/io/FilenameFilter;'
Static fields -
Instance fields -
#0 : (in Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder$1;)
name : 'this$1'
type : 'Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder;'
access : 0x1010 (FINAL SYNTHETIC)
#1 : (in Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder$1;)
name : 'val$fileNamePrefix'
type : 'Ljava/lang/String;'
access : 0x1012 (PRIVATE FINAL SYNTHETIC)
Direct methods -
#0 : (in Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder$1;)
name : '
Class #11 -
Class descriptor : 'Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder$2;'
Access flags : 0x0000 ()
Superclass : 'Ljava/lang/Object;'
Interfaces -
#0 : 'Ljava/io/FileFilter;'
Static fields -
Instance fields -
#0 : (in Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder$2;)
name : 'this$1'
type : 'Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder;'
access : 0x1010 (FINAL SYNTHETIC)
Direct methods -
#0 : (in Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder$2;)
name : '
Class #12 -
Class descriptor : 'Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder;'
Access flags : 0x0001 (PUBLIC)
Superclass : 'Ljava/lang/Object;'
Interfaces -
Static fields -
#0 : (in Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder;)
name : '$SWITCH_TABLE$com$stericson$RootTools$containers$RootClass$READ_STATE'
type : '[I'
access : 0x100a (PRIVATE STATIC SYNTHETIC)
Instance fields -
#0 : (in Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder;)
name : 'AVOIDDIRPATH'
type : 'Ljava/lang/String;'
access : 0x0012 (PRIVATE FINAL)
#1 : (in Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder;)
name : 'classFiles'
type : 'Ljava/util/List;'
access : 0x0002 (PRIVATE)
Direct methods -
#0 : (in Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder;)
name : '$SWITCH_TABLE$com$stericson$RootTools$containers$RootClass$READ_STATE'
type : '()[I'
access : 0x1008 (STATIC SYNTHETIC)
code -
registers : 3
ins : 0
outs : 1
insns size : 37 16-bit code units
catches : 2
0x000c - 0x0015
Ljava/lang/NoSuchFieldError; -> 0x0023
0x0015 - 0x001e
Ljava/lang/NoSuchFieldError; -> 0x0021
positions :
0x0000 line=60
locals :
#1 : (in Lcom/stericson/RootTools/containers/RootClass$AnnotationsFinder;)
name : '
Class #13 -
Class descriptor : 'Lcom/stericson/RootTools/containers/RootClass$RootArgs;'
Access flags : 0x0001 (PUBLIC)
Superclass : 'Ljava/lang/Object;'
Interfaces -
Static fields -
Instance fields -
#0 : (in Lcom/stericson/RootTools/containers/RootClass$RootArgs;)
name : 'args'
type : '[Ljava/lang/String;'
access : 0x0001 (PUBLIC)
#1 : (in Lcom/stericson/RootTools/containers/RootClass$RootArgs;)
name : 'this$0'
type : 'Lcom/stericson/RootTools/containers/RootClass;'
access : 0x1010 (FINAL SYNTHETIC)
Direct methods -
#0 : (in Lcom/stericson/RootTools/containers/RootClass$RootArgs;)
name : '
Class #14 -
Class descriptor : 'Lcom/stericson/RootTools/containers/RootClass;'
Access flags : 0x0001 (PUBLIC)
Superclass : 'Ljava/lang/Object;'
Interfaces -
Static fields -
#0 : (in Lcom/stericson/RootTools/containers/RootClass;)
name : 'PATH_TO_DX'
type : 'Ljava/lang/String;'
access : 0x0008 (STATIC)
Instance fields -
Direct methods -
#0 : (in Lcom/stericson/RootTools/containers/RootClass;)
name : '
Class #15 -
Class descriptor : 'Lcom/stericson/RootToolsTests/NativeJavaClass;'
Access flags : 0x0001 (PUBLIC)
Superclass : 'Ljava/lang/Object;'
Interfaces -
Static fields -
Instance fields -
Direct methods -
#0 : (in Lcom/stericson/RootToolsTests/NativeJavaClass;)
name : '
DelverActivity.RootToolsTest should be the only RootClass.Candidate annotated class in my source. NativeJavaClass is from the RootTools test package.
Any ideas would be much appreciated, thanks!
I also get this error on my Sony Xperia Z2 using the latest Cyanogenmod 11. My Root class is very simple:
package com.example.myapp;
import com.stericson.RootTools.containers.RootClass;
@RootClass.Candidate public class RootTest { public static void main (String [] args) { System.out.println("Test"); } }
When I execute this class I also get the error message. Here is my log output:
06-25 11:38:17.167: D/RootTools v3.4(22124): Starting Root Shell! 06-25 11:38:17.167: D/RootTools v3.4(22124): Starting shell: su 06-25 11:38:17.177: D/su(22150): su invoked. 06-25 11:38:17.177: D/su(22150): starting daemon client 10214 10214 06-25 11:38:17.177: D/su(22153): remote pid: 22150 06-25 11:38:17.177: D/su(22153): remote pts_slave: 06-25 11:38:17.177: D/su(22153): waiting for child exit 06-25 11:38:17.177: D/su(22155): su invoked. 06-25 11:38:17.187: D/su(22155): db allowed 06-25 11:38:17.187: D/su(22155): 10214 /system/xbin/su executing 0 /system/bin/sh using binary /system/bin/sh : sh 06-25 11:38:17.187: D/RootTools v3.4(22124): CommandHandler not created 06-25 11:38:17.197: D/RootTools v3.4(22124): Executing: dalvikvm -cp /data/data/com.example.myapp/files/anbuild.dex com.android.internal.util.WithFramework com.stericson.RootTools.containers.RootClass com.example.myapp.RootTest 06-25 11:38:17.197: D/RootTools v3.4(22124): Checking for Root access 06-25 11:38:17.207: D/RootTools v3.4(22124): CommandHandler not created 06-25 11:38:17.207: D/RootTools v3.4(22124): Using Existing Root Shell! 06-25 11:38:17.207: D/RootTools v3.4(22124): Command is in position 1 currently executing command at position 1 06-25 11:38:17.217: D/RootTools v3.4(22124): Executing: id 06-25 11:38:17.237: D/dalvikvm(22166): Trying to load lib libjavacore.so 0x0 06-25 11:38:17.247: D/dalvikvm(22166): Added shared lib libjavacore.so 0x0 06-25 11:38:17.257: D/dalvikvm(22166): Trying to load lib libnativehelper.so 0x0 06-25 11:38:17.257: D/dalvikvm(22166): Added shared lib libnativehelper.so 0x0 06-25 11:38:17.257: D/dalvikvm(22166): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init 06-25 11:38:17.287: W/dalvikvm(22166): threadid=1: thread exiting with uncaught exception (group=0xb5e05ce0) 06-25 11:38:17.287: D/Command(22124): ID: 43, java.lang.ClassNotFoundException: com.stericson.RootTools.containers.RootClass 06-25 11:38:17.287: D/Command(22124): ID: 43, at java.lang.Class.classForName(Native Method) 06-25 11:38:17.287: D/Command(22124): ID: 43, at java.lang.Class.forName(Class.java:251) 06-25 11:38:17.287: D/Command(22124): ID: 43, at java.lang.Class.forName(Class.java:216) 06-25 11:38:17.287: D/Command(22124): ID: 43, at com.android.internal.util.WithFramework.main(WithFramework.java:36) 06-25 11:38:17.287: D/Command(22124): ID: 43, at dalvik.system.NativeStart.main(Native Method) 06-25 11:38:17.287: D/Command(22124): ID: 43, Caused by: java.lang.NoClassDefFoundError: com/stericson/RootTools/containers/RootClass 06-25 11:38:17.287: D/Command(22124): ID: 43, ... 5 more 06-25 11:38:17.287: D/Command(22124): ID: 43, Caused by: java.lang.ClassNotFoundException: Didn't find class "com.stericson.RootTools.containers.RootClass" on path: DexPathList[[dex file "dalvik.system.DexFile@b5e0f7b8"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] 06-25 11:38:17.287: D/Command(22124): ID: 43, at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 06-25 11:38:17.287: D/Command(22124): ID: 43, at java.lang.ClassLoader.loadClass(ClassLoader.java:497) 06-25 11:38:17.287: D/Command(22124): ID: 43, at java.lang.ClassLoader.loadClass(ClassLoader.java:457) 06-25 11:38:17.287: D/Command(22124): ID: 43, ... 5 more 06-25 11:38:17.497: D/RootTools v3.4(22124): Command 43 finished.
What am I doing wrong?
I got it working. Was having the same problem. And I had a guess that "since the RootClass isn't found, let's put it into the anbuild.dex" -- and it works.
Comment out the AVOIDPATH, and then add annotation for itself. Hack the lookup routine so that it catches itself.
A better solution:
- Create a new android project, and put RootClass in it. (for runtime)
- Create a new Java project, and put RootClass in it. (for compile)
- Make your project extract anbuild.dex manually. (It doesn't seem to extract automatically here) Extract it under getActivity().getFilesDir()
- Hack the Java side to copy the android project .class files to your target build path before building the jar
- Run it in your target path
- Clean you project, rebuild
- Test it. =)
@Fusion Can you confirm whether this is still an open issue or can be closed?