美文网首页
处理AS报错:compileDebugJavaWithJavac

处理AS报错:compileDebugJavaWithJavac

作者: KtYY | 来源:发表于2017-07-04 10:12 被阅读0次

在项目中,准备使用Realm作缓存。在gradle都配置好之后,写了个demo进行测试,真的很简单的demo。没想到 Android studio 编译时,报错:

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.

是的,错误信息只有这些,无从下手。
经过一轮摸索,在工程目录下,打开命令窗口,执行 gradlew compileDebugJavaWithJavac , 得到文章最后面的编译信息。
关注这一项:app:compileDebugJavaWithJavac,看到了导致错误的信息:

app:compileDebugJavaWithJavac
注: Processing class InventoryBarcodeBean
错误: A default public constructor with no argument must be declared if a custom constructor is declared.

是的,就是InventoryBarcodeBean.class 缺了空参构造方法。然后为什么需要空参构造呢,这里就不详细说明了。

附:命令窗口执行 gradlew compileDebugJavaWithJavac 打印出来的信息

To honour the JVM settings for this build a new JVM will be forked. Please consi
der using the daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:extractProguardFiles
:app:preReleaseBuild
:app:prepareComAndroidSupportAnimatedVectorDrawable2510Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72510Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2510Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCompat2510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUi2510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUtils2510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportFragment2510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportMediaCompat2510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42510Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2510Library UP-TO-DATE
:app:prepareComAndroidSupportTransition2510Library UP-TO-DATE
:app:prepareComFacebookStethoStetho141Library UP-TO-DATE
:app:prepareComGetkeepsafeRelinkerRelinker122Library UP-TO-DATE
:app:prepareComJiechicLibraryXUtils2614Library UP-TO-DATE
:app:prepareComTencentBuglyCrashreport265Library UP-TO-DATE
:app:prepareComUphycaStetho_realm200Library UP-TO-DATE
:app:prepareIoRealmRealmAndroidLibrary202Library UP-TO-DATE
:app:prepareOrgXutilsXutils3336Library UP-TO-DATE
:app:prepareWheelviewLibrary UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac
注: Processing class InventoryBarcodeBean
错误: A default public constructor with no argument must be declared if a custom
constructor is declared.
注: Creating DefaultRealmModule
警告: 将不对在最后一个循环中创建的类型为 'io.realm.DefaultRealmModule' 的文件进
行注释处理。
警告: 将不对在最后一个循环中创建的类型为 'io.realm.DefaultRealmModuleMediator'
的文件进行注释处理。
1 个错误
2 个警告
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.
    Compilation failed; see the compiler error output for details.
  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug
    option to get more log output.

相关文章

网友评论

      本文标题:处理AS报错:compileDebugJavaWithJavac

      本文链接:https://www.haomeiwen.com/subject/yasthxtx.html