Skip to content
Advertisement

How to fix app:lint error when building flutter app?

For some reason, all of a sudden my app cannot build anymore. First I had flutter devtools problem, then I upgraded to Flutter 2.8.1 and now my app cannot build. I tried upgrading Gradle to 7.3.3 and JDK 17 and still, my app cannot build, I searched the whole GitHub and StackOverflow and cannot find a solution.

This was my first error:

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
←[33m> ←[39mUnable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @27ec650

Which I fixed by adding:

--add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED

to gradle.properties.

But now when I try to build I get another error:

* What went wrong:
Execution failed for task ':app:lint'.
←[33m> ←[39mLint found errors in the project; aborting build.

  Fix the issues identified by lint, or add the following to your build script to proceed with errors:
  ...
  android {
      lintOptions {
          abortOnError false
      }
  }
  ...
  Errors found:

  ...androidappsrcmainAndroidManifest.xml:5: Error: Class referenced in the manifest, com.example.my_app.${applicationName}, was not found in the project or the libraries [MissingClass]
          android:name="${applicationName}"
                        ~~~~~~~~~~~~~~~~~~

Here is my flutter doctor -v

[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.22000.376], locale hr-HR)
    • Flutter version 2.8.1 at C:flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (12 days ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at C:UsersdominAppDataLocalAndroidsdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: C:Program FilesAndroidAndroid Studiojrebinjava
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:Program FilesGoogleChromeApplicationchrome.exe

[√] Android Studio (version 2020.3)
    • Android Studio at C:Program FilesAndroidAndroid Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] IntelliJ IDEA Community Edition (version 2021.2)
    • IntelliJ at C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2021.2.2
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] VS Code (version 1.63.2)
    • VS Code at C:UsersdominAppDataLocalProgramsMicrosoft VS Code
    • Flutter extension version 3.29.0

[√] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.110
    • Edge (web)   • edge   • web-javascript • Microsoft Edge 96.0.1054.43

• No issues found!

Advertisement

Answer

Add this in your app/build.gradle file

android {
    //...
    lintOptions {
        abortOnError false
    }
}
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement