比如greendao生成代码,突然不能用了,报错和下面这种差不多

11:41:35 PM: Executing task 'TxtUtil.main()'...

Executing tasks: [TxtUtil.main()] in project /Users/tinytongtong/Documents/workspace/as/self/BlogDemo


FAILURE: Build failed with an exception.

* Where:
Initialization script '/private/var/folders/qw/8_p1t59142d0xntgn799rt1c0000gn/T/TxtUtil_main__.gradle' line: 20

* What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':app:TxtUtil.main()'.
   > SourceSet with name 'main' not found.

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.6.4/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 207ms
11:41:35 PM: Task execution finished 'TxtUtil.main()'.

解决方法:
.idea/gradle.xml

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="GradleMigrationSettings" migrationVersion="1" />
  <component name="GradleSettings">
    <option name="linkedExternalProjectsSettings">
      <GradleProjectSettings>
      <!-- !!!!!!!下面!!!!!!!! -->
        <option name="delegatedBuild" value="false" />
      <!-- !!!!!!!上面!!!!!!!! -->
        <compositeConfiguration>
          <compositeBuild compositeDefinitionSource="SCRIPT" />
        </compositeConfiguration>
        <option name="distributionType" value="DEFAULT_WRAPPED" />
        <option name="externalProjectPath" value="$PROJECT_DIR$" />
        <option name="modules">
          <set>
            <option value="$PROJECT_DIR$" />
            <option value="$PROJECT_DIR$/app" />
            <option value="$PROJECT_DIR$/moduleThird" />
            <option value="$PROJECT_DIR$/zxinglib" />
          </set>
        </option>
        <option name="resolveModulePerSourceSet" value="false" />
        <option name="testRunner" value="PLATFORM" />
      </GradleProjectSettings>
    </option>
  </component>
</project>

把那句话加上,重新编译即可(点那个大象编译)

标签: 安卓, java

添加新评论