CalebFenton / simplify

Android virtual machine and deobfuscator
Other
4.45k stars 438 forks source link

Error: A JNI error has occurred, please check your installation and try again #137

Closed dev7machine closed 4 years ago

dev7machine commented 4 years ago

I am following the installation guide but when I try to run the script onobfuscated-app.apk, I am getting the following error.

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/cf/smalivm/exception/UnhandledVirtualException
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.cf.smalivm.exception.UnhandledVirtualException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 7 more

Screenshot: Screenshot from 2020-02-10 13-43-55

Development Environment: java version "1.8.0_241" Gradle Version: 6.1.1

I have tested it on 3 different machines with the same dev environment. 1: Local ubuntu machine 2: Virtual Santoku machine 3: AWS Server ubuntu machine

This is my first time using simplify, kindly guide me if I am missing something. Thanks

P.S: I cloned it recursively as mentioned in build guide.

CalebFenton commented 4 years ago

It looks like the jar built in one second, which is wrong. The error is saying that some classes are missing.

Did you clone recursively? How big is the jar? Did you try clean and rebuild?

On Mon, Feb 10, 2020, 10:47 AM dev7machine notifications@github.com wrote:

I am following the installation guide https://github.com/CalebFenton/simplify#building but when I try to run the script on obfuscated-app.apk, I am getting the following error.

Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/cf/smalivm/exception/UnhandledVirtualException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) Caused by: java.lang.ClassNotFoundException: org.cf.smalivm.exception.UnhandledVirtualException at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 7 more

Screenshot: [image: Screenshot from 2020-02-10 13-43-55] https://user-images.githubusercontent.com/58460817/74133913-69b45a80-4c0b-11ea-9ab4-2418a98d724e.png

Development Environment: java version "1.8.0_241" Gradle Version: 6.1.1

I have tested it on 3 different machines with the same dev environment. 1: Local ubuntu machine 2: Virtual Santoku machine 3: AWS Server ubuntu machine

This is my first time using simplify, kindly guide me if I am missing something. Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/CalebFenton/simplify/issues/137?email_source=notifications&email_token=AAKLG4RMKSALSPK7M4UDSPTRCEIBNA5CNFSM4KSJ4MEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IMFV7SA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKLG4QN6FGPW4VXEHN5T4TRCEIBNANCNFSM4KSJ4MEA .

dev7machine commented 4 years ago

Actually it took 16 minutes to build jar on virtual machine, about 3 minutes to build jar on local/host machine and 39 seconds on AWS server. You are seeing 1 second in screenshot because I re run the command with --stacktrace flag. That's why it took just 1 second.

  1. Yes I cloned recursively.
  2. About 60K
  3. I have tried ./gradlew clean build command and this time build failed.

Here is the html report. http://simplifybuild.s3-website-us-east-1.amazonaws.com/

Here is the complete trace

ubuntu@ip-172-31-18-146:~/simplify$ ./gradlew clean build

> Task :smalivm:compileTestJava
/home/ubuntu/simplify/smalivm/src/test/java/org/cf/smalivm/opcode/InvokeOpTest.java:462: warning: [deprecation] newInstance() in Class has been deprecated
            Object instance = virtualClass.newInstance();
                                          ^
  where T is a type-variable:
    T extends Object declared in class Class
/home/ubuntu/simplify/smalivm/src/test/java/org/cf/smalivm/opcode/InvokeOpTest.java:473: warning: [deprecation] newInstance() in Class has been deprecated
            Object instance = virtualClass.newInstance();
                                          ^
  where T is a type-variable:
    T extends Object declared in class Class
/home/ubuntu/simplify/smalivm/src/test/java/org/cf/smalivm/opcode/InvokeOpTest.java:491: warning: [deprecation] newInstance() in Class has been deprecated
            Object instance = virtualClass.newInstance();
                                          ^
  where T is a type-variable:
    T extends Object declared in class Class
/home/ubuntu/simplify/smalivm/src/test/java/org/cf/smalivm/opcode/InvokeOpTest.java:503: warning: [deprecation] newInstance() in Class has been deprecated
            Object instance = virtualClass.newInstance();
                                          ^
  where T is a type-variable:
    T extends Object declared in class Class
/home/ubuntu/simplify/smalivm/src/test/java/org/cf/smalivm/opcode/InvokeOpTest.java:515: warning: [deprecation] newInstance() in Class has been deprecated
            Object instance = virtualClass.newInstance();
                                          ^
  where T is a type-variable:
    T extends Object declared in class Class
/home/ubuntu/simplify/smalivm/src/test/java/org/cf/smalivm/DataStructureBenchmark.java:23: warning: [deprecation] Integer(int) in Integer has been deprecated
            data[i] = new Integer(i);
                      ^
6 warnings

> Task :smalivm:test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.rits.cloning.Cloner (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/uk.com.robust-it/cloning/1.9.12/9053df24095825fd54512672b5ee29a2f197b1fa/cloning-1.9.12.jar) to field java.util.TreeSet.m
WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.rits.cloning.Cloner (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/uk.com.robust-it/cloning/1.9.12/9053df24095825fd54512672b5ee29a2f197b1fa/cloning-1.9.12.jar) to field java.util.TreeSet.m
WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.rits.cloning.Cloner (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/uk.com.robust-it/cloning/1.9.12/9053df24095825fd54512672b5ee29a2f197b1fa/cloning-1.9.12.jar) to field java.util.TreeSet.m
WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

TestMethodInheritance$ChildClass > canInvokeAbstractMethodThroughParentReference() FAILED
    java.lang.ClassFormatError at TestMethodInheritance.java:29

TestMethodInheritance$ChildClass > canInvokeParentMethodOfChild() FAILED
    java.lang.ClassFormatError at TestMethodInheritance.java:48
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.rits.cloning.Cloner (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/uk.com.robust-it/cloning/1.9.12/9053df24095825fd54512672b5ee29a2f197b1fa/cloning-1.9.12.jar) to field java.util.TreeSet.m
WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

> Task :simplify:test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.rits.cloning.Cloner (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/uk.com.robust-it/cloning/1.9.12/9053df24095825fd54512672b5ee29a2f197b1fa/cloning-1.9.12.jar) to field java.util.TreeSet.m
WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.rits.cloning.Cloner (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/uk.com.robust-it/cloning/1.9.12/9053df24095825fd54512672b5ee29a2f197b1fa/cloning-1.9.12.jar) to field java.util.TreeSet.m
WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

> Task :smalivm:test FAILED

FrameworkJarBuilderTest > frameworkClassesExistAndCanBeLoaded() FAILED
    java.lang.IllegalAccessError at FrameworkJarBuilderTest.java:29

626 tests completed, 3 failed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':smalivm:test'.
> There were failing tests. See the report at: file:///home/ubuntu/simplify/smalivm/build/reports/tests/test/index.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4m 2s
31 actionable tasks: 23 executed, 4 from cache, 4 up-to-date

I am not sure why this build failed this time because I already used fresh ubuntu server on AWS. I mean nothing was installed before. It got build successfully but this time got failed.

CalebFenton commented 4 years ago

That jar is well small. Maybe I broke something. Let me look into it, see if I can reproduce.

On Mon, Feb 10, 2020, 12:40 PM dev7machine notifications@github.com wrote:

Actually it took 16 minutes to build jar on virtual machine, about 3 minutes to build jar on local/host machine and 39 seconds on AWS server. You are seeing 1 second in screenshot because I re run the command with --stacktrace flag. That's why it took just 1 second.

  1. Yes I cloned recursively.
  2. About 60K
  3. I have tried ./gradlew clean build command and this time build failed. Here is the complete trace

ubuntu@ip-172-31-18-146:~/simplify$ ./gradlew clean build

Task :smalivm:compileTestJava /home/ubuntu/simplify/smalivm/src/test/java/org/cf/smalivm/opcode/InvokeOpTest.java:462: warning: [deprecation] newInstance() in Class has been deprecated Object instance = virtualClass.newInstance(); ^ where T is a type-variable: T extends Object declared in class Class /home/ubuntu/simplify/smalivm/src/test/java/org/cf/smalivm/opcode/InvokeOpTest.java:473: warning: [deprecation] newInstance() in Class has been deprecated Object instance = virtualClass.newInstance(); ^ where T is a type-variable: T extends Object declared in class Class /home/ubuntu/simplify/smalivm/src/test/java/org/cf/smalivm/opcode/InvokeOpTest.java:491: warning: [deprecation] newInstance() in Class has been deprecated Object instance = virtualClass.newInstance(); ^ where T is a type-variable: T extends Object declared in class Class /home/ubuntu/simplify/smalivm/src/test/java/org/cf/smalivm/opcode/InvokeOpTest.java:503: warning: [deprecation] newInstance() in Class has been deprecated Object instance = virtualClass.newInstance(); ^ where T is a type-variable: T extends Object declared in class Class /home/ubuntu/simplify/smalivm/src/test/java/org/cf/smalivm/opcode/InvokeOpTest.java:515: warning: [deprecation] newInstance() in Class has been deprecated Object instance = virtualClass.newInstance(); ^ where T is a type-variable: T extends Object declared in class Class /home/ubuntu/simplify/smalivm/src/test/java/org/cf/smalivm/DataStructureBenchmark.java:23: warning: [deprecation] Integer(int) in Integer has been deprecated data[i] = new Integer(i); ^ 6 warnings

Task :smalivm:test WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.rits.cloning.Cloner (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/uk.com.robust-it/cloning/1.9.12/9053df24095825fd54512672b5ee29a2f197b1fa/cloning-1.9.12.jar) to field java.util.TreeSet.m WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.rits.cloning.Cloner (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/uk.com.robust-it/cloning/1.9.12/9053df24095825fd54512672b5ee29a2f197b1fa/cloning-1.9.12.jar) to field java.util.TreeSet.m WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.rits.cloning.Cloner (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/uk.com.robust-it/cloning/1.9.12/9053df24095825fd54512672b5ee29a2f197b1fa/cloning-1.9.12.jar) to field java.util.TreeSet.m WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

TestMethodInheritance$ChildClass > canInvokeAbstractMethodThroughParentReference() FAILED java.lang.ClassFormatError at TestMethodInheritance.java:29

TestMethodInheritance$ChildClass > canInvokeParentMethodOfChild() FAILED java.lang.ClassFormatError at TestMethodInheritance.java:48 WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.rits.cloning.Cloner (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/uk.com.robust-it/cloning/1.9.12/9053df24095825fd54512672b5ee29a2f197b1fa/cloning-1.9.12.jar) to field java.util.TreeSet.m WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

Task :simplify:test WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.rits.cloning.Cloner (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/uk.com.robust-it/cloning/1.9.12/9053df24095825fd54512672b5ee29a2f197b1fa/cloning-1.9.12.jar) to field java.util.TreeSet.m WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.rits.cloning.Cloner (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/uk.com.robust-it/cloning/1.9.12/9053df24095825fd54512672b5ee29a2f197b1fa/cloning-1.9.12.jar) to field java.util.TreeSet.m WARNING: Please consider reporting this to the maintainers of com.rits.cloning.Cloner WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

Task :smalivm:test FAILED

FrameworkJarBuilderTest > frameworkClassesExistAndCanBeLoaded() FAILED java.lang.IllegalAccessError at FrameworkJarBuilderTest.java:29

626 tests completed, 3 failed

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':smalivm:test'.

    There were failing tests. See the report at: file:///home/ubuntu/simplify/smalivm/build/reports/tests/test/index.html

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 4m 2s 31 actionable tasks: 23 executed, 4 from cache, 4 up-to-date

I am not sure why this build failed this time because I already used fresh ubuntu server on AWS. I mean nothing was installed before. It got build successfully but this time got failed.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CalebFenton/simplify/issues/137?email_source=notifications&email_token=AAKLG4RKJNNLYLZNJG3QHGLRCEVLTA5CNFSM4KSJ4MEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELIA34Y#issuecomment-584060403, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKLG4UCR3RIWWI65BKG6YLRCEVLTANCNFSM4KSJ4MEA .

dev7machine commented 4 years ago

@CalebFenton I have changed the branch to v1.2.1 and build it again and that's worked perfectly fine. So its something wrong with new code. :)

CalebFenton commented 4 years ago

Good idea.

I rewrote the all the build scripts to be gradle 6 compliant and changed some stuff for sdbg so it's quite possible it's just a 5 minute fix.

On Mon, Feb 10, 2020, 3:49 PM dev7machine notifications@github.com wrote:

@CalebFenton https://github.com/CalebFenton I have changed the branch to v1.2.1 and build it again and that's worked perfectly fine. So its something wrong with new code. :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CalebFenton/simplify/issues/137?email_source=notifications&email_token=AAKLG4SNLN3FTRT5OJUQHZDRCFLNDA5CNFSM4KSJ4MEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELISCEA#issuecomment-584130832, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKLG4Q73HO4G7FPSFYHWZDRCFLNDANCNFSM4KSJ4MEA .

Eightgreen commented 4 years ago

I have the same issue. I tried v1.2.1 version ,and got "BUILD FAILED" messange. Any suggestion for me?Thanks bro!

dev7machine commented 4 years ago

@Eightgreen Would you please send the stacktrace? Why it failed?

./gradlew fatjar --stacktrace

CalebFenton commented 4 years ago

Should be good now. Let me know if you still have an issue.

Eightgreen commented 4 years ago

It's pretty good now! Thank you!

Caleb Fenton notifications@github.com 於 2020年2月18日 週二 上午5:02寫道:

Should be good now. Let me know if you still have an issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CalebFenton/simplify/issues/137?email_source=notifications&email_token=AE7X6FLN54NVA6O2ER6FHQDRDL3NDA5CNFSM4KSJ4MEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL7VD2Y#issuecomment-587157995, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE7X6FI5E2KRZFVUD7QTWLTRDL3NDANCNFSM4KSJ4MEA .