CompilationException: Back-end (JVM) Internal error: wrong bytecode【解决方法】

今天爱分享给大家带来CompilationException: Back-end (JVM) Internal error: wrong bytecode【解决方法】,希望能够帮助到大家。
说明:
flutter项目运行报错,具体什么原因不清楚,大概是因为kotlin版本更新的太快,兼容性出了问题,搞了好久终于解决了,

报错信息:


e: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: wrong bytecode generated
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    // annotable parameter count: 3 (visible)
    // annotable parameter count: 3 (invisible)
    @Lorg/jetbrains/annotations/NotNull;() // invisible, parameter 0
    @Lorg/jetbrains/annotations/NotNull;() // invisible, parameter 2
   L0
   L1
   L2
    LINENUMBER 25 L2
    INVOKESTATIC kotlinx/coroutines/Dispatchers.getIO ()Lkotlinx/coroutines/CoroutineDispatcher;
    CHECKCAST kotlin/coroutines/CoroutineContext
    NEW com/jarvan/fluwx/io/ImagesIOIml$compressedByteArray$2
    DUP
    ALOAD 0
    ALOAD 1
    ALOAD 2
    ACONST_NULL
    INVOKESPECIAL com/jarvan/fluwx/io/ImagesIOIml$compressedByteArray$2. (Lcom/jarvan/fluwx/io/ImagesIOIml;Lkotlin/jvm/internal/Ref$ObjectRef;Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/coroutines/Continuation;)V
    CHECKCAST kotlin/jvm/functions/Function2
    ALOAD 3
    INVOKESTATIC kotlinx/coroutines/BuildersKt.withContext (Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
   L3
    LINENUMBER 47 L3
    ARETURN
   L4
    LOCALVARIABLE this Lcom/jarvan/fluwx/io/ImagesIOIml; L0 L4 0
    LOCALVARIABLE context Landroid/content/Context; L0 L4 1
    LOCALVARIABLE maxSize I L0 L4 2
    LOCALVARIABLE $completion Lkotlin/coroutines/Continuation; L0 L4 3
    MAXSTACK = 7
    MAXLOCALS = 4

File being compiled at position: (25,5) in E:/programming/flutter/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluwx-2.4.1/android/src/main/kotlin/com/jarvan/fluwx/io/ImagesIO.kt
The root cause org.jetbrains.kotlin.codegen.CompilationException was thrown at: org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:92)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.endVisit(FunctionCodegen.java:990)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethodBody(FunctionCodegen.java:487)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:260)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:176)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.gen(FunctionCodegen.java:147)
	at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:197)
	at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateDeclaration(ClassBodyCodegen.java:166)
	at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateBody(ClassBodyCodegen.java:86)
	at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:129)
	at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:302)
	at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:286)
	at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateClassesAndObjectsInFile(PackageCodegenImpl.java:118)
	at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateFile(PackageCodegenImpl.java:137)
	at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:68)
	at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:96)
	at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generateModule(CodegenFactory.kt:67)
	at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.doGenerateFiles(KotlinCodegenFacade.java:47)
	at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:39)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:634)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:195)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:164)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
	at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:349)
	at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:105)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:237)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:37)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:79)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:91)
	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:606)
	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:99)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1645)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node:
compressedByteArray (Landroid/content/Context;ILkotlin/coroutines/Continuation;)Ljava/lang/Object;:
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    // annotable parameter count: 3 (visible)
    // annotable parameter count: 3 (invisible)
    @Lorg/jetbrains/annotations/NotNull;() // invisible, parameter 0
    @Lorg/jetbrains/annotations/NotNull;() // invisible, parameter 2
   L0
   L1
   L2
    LINENUMBER 25 L2
    INVOKESTATIC kotlinx/coroutines/Dispatchers.getIO ()Lkotlinx/coroutines/CoroutineDispatcher;
    CHECKCAST kotlin/coroutines/CoroutineContext
    NEW com/jarvan/fluwx/io/ImagesIOIml$compressedByteArray$2
    DUP
    ALOAD 0
    ALOAD 1
    ALOAD 2
    ACONST_NULL
    INVOKESPECIAL com/jarvan/fluwx/io/ImagesIOIml$compressedByteArray$2. (Lcom/jarvan/fluwx/io/ImagesIOIml;Lkotlin/jvm/internal/Ref$ObjectRef;Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/coroutines/Continuation;)V
    CHECKCAST kotlin/jvm/functions/Function2
    ALOAD 3
    INVOKESTATIC kotlinx/coroutines/BuildersKt.withContext (Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
   L3
    LINENUMBER 47 L3
    ARETURN
   L4
    LOCALVARIABLE this Lcom/jarvan/fluwx/io/ImagesIOIml; L0 L4 0
    LOCALVARIABLE context Landroid/content/Context; L0 L4 1
    LOCALVARIABLE maxSize I L0 L4 2
    LOCALVARIABLE $completion Lkotlin/coroutines/Continuation; L0 L4 3
    MAXSTACK = 7
    MAXLOCALS = 4

Element is unknownThe root cause org.jetbrains.kotlin.codegen.CompilationException was thrown at: org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:92)
	at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:92)
	at org.jetbrains.kotlin.codegen.FunctionCodegen.endVisit(FunctionCodegen.java:983)
	... 50 more
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node:
compressedByteArray (Landroid/content/Context;ILkotlin/coroutines/Continuation;)Ljava/lang/Object;:
  @Lorg/jetbrains/annotations/Nullable;() // invisible
    // annotable parameter count: 3 (visible)
    // annotable parameter count: 3 (invisible)
    @Lorg/jetbrains/annotations/NotNull;() // invisible, parameter 0
    @Lorg/jetbrains/annotations/NotNull;() // invisible, parameter 2
   L0
    LINENUMBER 25 L0
    INVOKESTATIC kotlinx/coroutines/Dispatchers.getIO ()Lkotlinx/coroutines/CoroutineDispatcher;
    CHECKCAST kotlin/coroutines/CoroutineContext
    NEW com/jarvan/fluwx/io/ImagesIOIml$compressedByteArray$2
    DUP
    ALOAD 0
    ALOAD 1
    ALOAD 2
    ACONST_NULL
    INVOKESPECIAL com/jarvan/fluwx/io/ImagesIOIml$compressedByteArray$2. (Lcom/jarvan/fluwx/io/ImagesIOIml;Lkotlin/jvm/internal/Ref$ObjectRef;Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/coroutines/Continuation;)V
    CHECKCAST kotlin/jvm/functions/Function2
    ALOAD 3
    INVOKESTATIC kotlinx/coroutines/BuildersKt.withContext (Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
   L1
    LINENUMBER 47 L1
    ARETURN
   L2
    LOCALVARIABLE this Lcom/jarvan/fluwx/io/ImagesIOIml; L0 L2 0
    LOCALVARIABLE context Landroid/content/Context; L0 L2 1
    LOCALVARIABLE maxSize I L0 L2 2
    LOCALVARIABLE $completion Lkotlin/coroutines/Continuation; L0 L2 3
    MAXSTACK = 7
    MAXLOCALS = 4

Element is unknownThe root cause java.lang.AssertionError was thrown at: org.jetbrains.kotlin.codegen.optimization.MethodVerifier.transform(MethodVerifier.kt:28)
	at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:92)
	at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:90)
	... 51 more
Caused by: java.lang.AssertionError: AFTER mandatory stack transformations: incorrect bytecode
	at org.jetbrains.kotlin.codegen.optimization.MethodVerifier.transform(MethodVerifier.kt:28)
	at org.jetbrains.kotlin.codegen.optimization.transformer.CompositeMethodTransformer.transform(CompositeMethodTransformer.kt:25)
	at org.jetbrains.kotlin.codegen.optimization.OptimizationMethodVisitor.performTransformations(OptimizationMethodVisitor.kt:62)
	at org.jetbrains.kotlin.codegen.TransformationMethodVisitor.visitEnd(TransformationMethodVisitor.kt:70)
	... 52 more
Caused by: java.lang.RuntimeException: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 8: Expected an object reference, but found I
	at org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer.runAnalyzer(MethodTransformer.java:34)
	at org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer.analyze(MethodTransformer.java:44)
	at org.jetbrains.kotlin.codegen.optimization.MethodVerifier.transform(MethodVerifier.kt:26)
	... 55 more
Caused by: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 8: Expected an object reference, but found I
	at org.jetbrains.org.objectweb.asm.tree.analysis.Analyzer.analyze(Analyzer.java:291)
	at org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer.runAnalyzer(MethodTransformer.java:31)
	... 57 more
Caused by: org.jetbrains.org.objectweb.asm.tree.analysis.AnalyzerException: Expected an object reference, but found I
	at org.jetbrains.org.objectweb.asm.tree.analysis.BasicVerifier.copyOperation(BasicVerifier.java:90)
	at org.jetbrains.org.objectweb.asm.tree.analysis.BasicVerifier.copyOperation(BasicVerifier.java:43)
	at org.jetbrains.org.objectweb.asm.tree.analysis.Frame.execute(Frame.java:288)
	at org.jetbrains.org.objectweb.asm.tree.analysis.Analyzer.analyze(Analyzer.java:187)
	... 58 more


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':fluwx:compileDebugKotlin'.
> Compilation error. See log for more details

* 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 1m 3s
Exception: Gradle task assembleDebug failed with exit code 1



解决方案:

CompilationException: Back-end (JVM) Internal error: wrong bytecode【解决方法】插图

CompilationException: Back-end (JVM) Internal error: wrong bytecode【解决方法】插图(1)

CompilationException: Back-end (JVM) Internal error: wrong bytecode【解决方法】插图(2)

CompilationException: Back-end (JVM) Internal error: wrong bytecode【解决方法】插图(3)

一定要把那个kotlin代码支持的勾取消掉

CompilationException: Back-end (JVM) Internal error: wrong bytecode【解决方法】插图(4)

最后把之前无法运行的项目文件全部复制到这个新的项目里就可以了,然后运行就可以跑起来了。

转载:https://blog.csdn.net/weixin_45405207/article/details/110311005

人已赞赏
安卓

Execution failed for task ':app:processDevDebugResources'.【解决办法】

2020-11-16 15:25:05

安卓

MediaPlayer(362): error (-38, 0)【解决方法】

2020-12-23 11:42:47

'); })();