question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.UnsupportedOperationException: can't load this type of class file (in android)

See original GitHub issue

When i use the enforce(sub, obj, act) in android, there will be some Error thrown from the aviator. Detailed log is as below:

java.lang.ExceptionInInitializerError
        at com.googlecode.aviator.AviatorEvaluator$StaticHolder.access$000(AviatorEvaluator.java:90)
        at com.googlecode.aviator.AviatorEvaluator.getInstance(AviatorEvaluator.java:101)
        at com.googlecode.aviator.AviatorEvaluator.<clinit>(AviatorEvaluator.java:61)
        at com.googlecode.aviator.AviatorEvaluator.newInstance(AviatorEvaluator.java:87)
        at org.casbin.jcasbin.main.CoreEnforcer.enforce(CoreEnforcer.java:423)
        at org.casbin.jcasbin.main.CoreEnforcer.enforce(CoreEnforcer.java:549)
        At xxxxxx…..
        at android.os.AsyncTask$3.call(AsyncTask.java:394)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: com.googlecode.aviator.exception.CompileExpressionErrorException: define class error
        at com.googlecode.aviator.code.asm.ASMCodeGenerator.getResult(ASMCodeGenerator.java:849)
        at com.googlecode.aviator.code.OptimizeCodeGenerator.getResult(OptimizeCodeGenerator.java:440)
        at com.googlecode.aviator.code.LambdaGenerator.getResult(LambdaGenerator.java:424)
        at com.googlecode.aviator.code.LambdaGenerator.getLmabdaBootstrap(LambdaGenerator.java:189)
        at com.googlecode.aviator.code.OptimizeCodeGenerator.onLambdaBodyEnd(OptimizeCodeGenerator.java:785)
        at com.googlecode.aviator.code.LambdaGenerator.onLambdaBodyEnd(LambdaGenerator.java:472)
        at com.googlecode.aviator.parser.ExpressionParser.ifStatement(ExpressionParser.java:1916)
        at com.googlecode.aviator.parser.ExpressionParser.statement(ExpressionParser.java:1627)
        at com.googlecode.aviator.parser.ExpressionParser.statements(ExpressionParser.java:1853)
        at com.googlecode.aviator.parser.ExpressionParser.forStatement(ExpressionParser.java:1789)
        at com.googlecode.aviator.parser.ExpressionParser.statement(ExpressionParser.java:1634)
        at com.googlecode.aviator.parser.ExpressionParser.statements(ExpressionParser.java:1853)
        at com.googlecode.aviator.parser.ExpressionParser.lambda(ExpressionParser.java:793)
        at com.googlecode.aviator.parser.ExpressionParser.fnStatement(ExpressionParser.java:1265)
        at com.googlecode.aviator.parser.ExpressionParser.statement(ExpressionParser.java:1656)
        at com.googlecode.aviator.parser.ExpressionParser.statements(ExpressionParser.java:1835)
        at com.googlecode.aviator.parser.ExpressionParser.parse(ExpressionParser.java:1106)
        at com.googlecode.aviator.parser.ExpressionParser.parse(ExpressionParser.java:1120)
        at com.googlecode.aviator.AviatorEvaluatorInstance.innerCompile(AviatorEvaluatorInstance.java:1494)
        at com.googlecode.aviator.AviatorEvaluatorInstance.compile(AviatorEvaluatorInstance.java:1455)
        at com.googlecode.aviator.AviatorEvaluatorInstance.compile(AviatorEvaluatorInstance.java:1413)
        at com.googlecode.aviator.AviatorEvaluatorInstance.loadInternalLibs(AviatorEvaluatorInstance.java:1029)
        at com.googlecode.aviator.AviatorEvaluatorInstance.loadLib(AviatorEvaluatorInstance.java:898)
        at com.googlecode.aviator.AviatorEvaluatorInstance.<init>(AviatorEvaluatorInstance.java:1072)
        at com.googlecode.aviator.AviatorEvaluator$StaticHolder.<clinit>(AviatorEvaluator.java:91)
        at com.googlecode.aviator.AviatorEvaluator$StaticHolder.access$000(AviatorEvaluator.java:90) 
        at com.googlecode.aviator.AviatorEvaluator.getInstance(AviatorEvaluator.java:101) 
        at com.googlecode.aviator.AviatorEvaluator.<clinit>(AviatorEvaluator.java:61) 
        at com.googlecode.aviator.AviatorEvaluator.newInstance(AviatorEvaluator.java:87) 
        at org.casbin.jcasbin.main.CoreEnforcer.enforce(CoreEnforcer.java:423) 
        at org.casbin.jcasbin.main.CoreEnforcer.enforce(CoreEnforcer.java:549) 
        At xxxxxx…..
        at android.os.AsyncTask$3.call(AsyncTask.java:394) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 
     Caused by: java.lang.UnsupportedOperationException: can't load this type of class file
        at java.lang.ClassLoader.defineClass(ClassLoader.java:517)
        at com.googlecode.aviator.parser.AviatorClassLoader.defineClass(AviatorClassLoader.java:32)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tangyang9464commented, Sep 28, 2021

@chancyWu thanks.I’ll make a PR to update version.

1reaction
tangyang9464commented, Sep 15, 2021

@chancyWu Can you test your application by using this version feat/android. You just need to use mvn install to package

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running Clojure on Android: "can't load this type of class file"
The problem is that Clojure has a DynamicClassLoader which as you might guess, loads classes made up at runtime, and Android doesn't support ......
Read more >
ClassLoader.java - Android Code Search
throw new UnsupportedOperationException("can't load this type of class file");. } /**. * Converts an array of bytes into an instance of class <tt>Class</tt> ......
Read more >
libdvm/src/main/java/java/lang/ClassLoader.java - Google Git
ProtectionDomain protectionDomain) throws java.lang.ClassFormatError {. throw new UnsupportedOperationException("can't load this type of class file");. }.
Read more >
Java – How to load a class from a byte array in android
I have the same problem that you have. The reason why I get the error "can't load this type of class file" is...
Read more >
How to Fix java.lang.UnsupportedClassVersionError - Baeldung
This error is telling us that our class was compiled at a higher version of Java than the version with which we tried...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found