CalebFenton/simplify

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

dev7machine opened this issue · 9 comments

I am following the installation guide 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:
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.

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 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. :)

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

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

./gradlew fatjar --stacktrace

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