Unity在安卓Build时报错解决:CommandInvokationFailure和编译器 (1.8.0-adoptopenjdk) 中出现异常错误

Posted 天富儿

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Unity在安卓Build时报错解决:CommandInvokationFailure和编译器 (1.8.0-adoptopenjdk) 中出现异常错误相关的知识,希望对你有一定的参考价值。

Unity在安卓Build时报错解决:CommandInvokationFailure和编译器(1.8.0-adoptopenjdk)中出现异常错误

错误描述

这个我是发现一系列的错误都在于这个Build问题,这里都列举一下:

  1. CommandInvokationFailure: Unable to install APK to device. Please make sure the android SDK is installed and is properly configured in the Editor. See the Console for more details.
    C:/Users/20180321/AppData/Local/Android/android-sdk\\platform-tools\\adb.exe -s “PA7310PGB8151137G” install -r “C:\\Users\\20180321\\Desktop\\pico01\\39.apk”

    • > Configure project :launcher
      WARNING: The option ‘android.enableR8’ is deprecated and should not be used anymore.
      It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8.

    • 编译器 (1.8.0-adoptopenjdk) 中出现异常错误。如果在 Bug Database (http://bugs.java.com) 中没有找到该错误, 请通过 Java Bug 报告页 (http://bugreport.java.com) 建立该 Java 编译器 Bug。请在报告中附上您的程序和以下诊断信息。谢谢。
      java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable N a m e I m p l ) a t c o m . s u n . t o o l s . j a v a c . u t i l . A s s e r t . e r r o r ( A s s e r t . j a v a : 133 ) a t c o m . s u n . t o o l s . j a v a c . c o d e . T y p e A n n o t a t i o n s . a n n o t a t i o n T y p e ( T y p e A n n o t a t i o n s . j a v a : 231 ) a t c o m . s u n . t o o l s . j a v a c . c o d e . T y p e A n n o t a t i o n s NameImpl) at com.sun.tools.javac.util.Assert.error(Assert.java:133) at com.sun.tools.javac.code.TypeAnnotations.annotationType(TypeAnnotations.java:231) at com.sun.tools.javac.code.TypeAnnotations NameImpl)atcom.sun.tools.javac.util.Assert.error(Assert.java:133)atcom.sun.tools.javac.code.TypeAnnotations.annotationType(TypeAnnotations.java:231)atcom.sun.tools.javac.code.TypeAnnotationsTypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:294)
      at com.sun.tools.javac.code.TypeAnnotations T y p e A n n o t a t i o n P o s i t i o n s . v i s i t V a r D e f ( T y p e A n n o t a t i o n s . j a v a : 1164 ) a t c o m . s u n . t o o l s . j a v a c . t r e e . J C T r e e TypeAnnotationPositions.visitVarDef(TypeAnnotations.java:1164) at com.sun.tools.javac.tree.JCTree TypeAnnotationPositions.visitVarDef(TypeAnnotations.java:1164)atcom.sun.tools.javac.tree.JCTreeJCVariableDecl.accept(JCTree.java:852)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.code.TypeAnnotations T y p e A n n o t a t i o n P o s i t i o n s . s c a n ( T y p e A n n o t a t i o n s . j a v a : 275 ) a t c o m . s u n . t o o l s . j a v a c . t r e e . T r e e S c a n n e r . s c a n ( T r e e S c a n n e r . j a v a : 57 ) a t c o m . s u n . t o o l s . j a v a c . c o d e . T y p e A n n o t a t i o n s TypeAnnotationPositions.scan(TypeAnnotations.java:275) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57) at com.sun.tools.javac.code.TypeAnnotations TypeAnnotationPositions.scan(TypeAnnotations.java:275)atcom.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)atcom.sun.tools.javac.code.TypeAnnotationsTypeAnnotationPositions.visitClassDef(TypeAnnotations.java:1042)
      at com.sun.tools.javac.tree.JCTree J C C l a s s D e c l . a c c e p t ( J C T r e e . j a v a : 693 ) a t c o m . s u n . t o o l s . j a v a c . t r e e . T r e e S c a n n e r . s c a n ( T r e e S c a n n e r . j a v a : 49 ) a t c o m . s u n . t o o l s . j a v a c . c o d e . T y p e A n n o t a t i o n s JCClassDecl.accept(JCTree.java:693) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49) at com.sun.tools.javac.code.TypeAnnotations JCClassDecl.accept(JCTree.java:693)atcom.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)atcom.sun.tools.javac.code.TypeAnnotationsTypeAnnotationPositions.scan(TypeAnnotations.java:275)
      at com.sun.tools.javac.code.TypeAnnotations$1.run(TypeAnnotations.java:127)
      at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:152)
      at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:129)
      at com.sun.tools.javac.comp.Enter.complete(Enter.java:512)
      at com.sun.tools.javac.comp.Enter.main(Enter.java:471)
      at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:982)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:857)
      at com.sun.tools.javac.main.Main.compile(Main.java:523)
      at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
      at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
      at org.gradle.api.internal.tasks.compile.AnnotationProcessingCompileTask.call(AnnotationProcessingCompileTask.java:93)
      at org.gradle.api.internal.tasks.compile.ResourceCleaningCompilationTask.call(ResourceCleaningCompilationTask.java:57)
      at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:54)
      at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:39)
      at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:100)
      at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:52)
      at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:38)
      at org.gradle.api.internal.tasks.compile.AnnotationProcessorDiscoveringCompiler.execute(AnnotationProcessorDiscoveringCompiler.java:51)
      at org.gradle.api.internal.tasks.compile.AnnotationProcessorDiscoveringCompiler.execute(AnnotationProcessorDiscoveringCompiler.java:37)
      at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:39)
      at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilerFactory$2.execute(IncrementalCompilerFactory.java:101)
      at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilerFactory$2.execute(IncrementalCompilerFactory.java:97)
      at org.gradle.api.internal.tasks.compile.incremental.IncrementalResultStoringCompiler.execute(IncrementalResultStoringCompiler.java:60)
      at org.gradle.api.internal.tasks.compile.incremental.IncrementalResultStoringCompiler.execute(IncrementalResultStoringCompiler.java:44)
      at org.gradle.api.internal.tasks.compile.CompileJavaBuildOperationReportingCompiler$2.call(CompileJavaBuildOperationReportingCompiler.java:59)
      at org.gradle.api.internal.tasks.compile.CompileJavaBuildOperationReportingCompiler 2. c a l l ( C o m p i l e J a v a B u i l d O p e r a t i o n R e p o r t i n g C o m p i l e r . j a v a : 51 ) a t o r g . g r a d l e . i n t e r n a l . o p e r a t i o n s . D e f a u l t B u i l d O p e r a t i o n E x e c u t o r 2.call(CompileJavaBuildOperationReportingCompiler.java:51) at org.gradle.internal.operations.DefaultBuildOperationExecutor 2.call(CompileJavaBuildOperationReportingCompiler.java:51)atorg.gradle.internal.operations.DefaultBuildOperationExecutorCallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
      at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
      at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
      at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
      at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
      at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
      at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
      at org.gradle.api.internal.tasks.compile.CompileJavaBuildOperationReportingCompiler.execute(CompileJavaBuildOperationReportingCompiler.java:51)
      at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:158)
      at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:126)
      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 org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
      at org.gradle.api.internal.project.taskfactory.IncrementalTaskInputsTaskAction.doExecute(IncrementalTaskInputsTaskAction.java:47)
      at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
      at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25)
      at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter 5. r u n ( E x e c u t e A c t i o n s T a s k E x e c u t e r . j a v a : 476 ) a t o r g . g r a d l e . i n t e r

      Qt Creator中增加新的ui文件时报错

      原因分析moc_开头的文件编译过程中没有又一次生成导致。

      解决的方法:删除编译产生的build目录。又一次编译就可以。


      错误类型截图例如以下:

      技术分享


      这个问题的解决。使得能够在不论什么时候都能够在project中加入新的ui文件。而不必在開始就加入全部的ui文件,降低了开发难度。

      对于这个问题的解决方法。个人认为这是最好的解决方法。为了解决问题。之前也查了非常多资料。但没有找到合适的方法。并且删除编译产生的文件。删除后能够又一次编译产生。。




      以上是关于Unity在安卓Build时报错解决:CommandInvokationFailure和编译器 (1.8.0-adoptopenjdk) 中出现异常错误的主要内容,如果未能解决你的问题,请参考以下文章

      unity导出的Android工程导入eclipse时报错

      Unity apk打包失败的解决方法

      build.xml打包时报错, 软件包 oracle.jdbc 不存在,请各位大虾帮忙解决下啊,已经困扰很久了。。

      解决Maven打包时报错"The packaging for this project did not assign a file to the build artifact"(示

      Unity安卓报错解决方法:android.content.res.Resources$NotFoundException

      Qt Creator中增加新的ui文件时报错