Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint found errors in the project; aborting build. #851

Closed
1 task done
Simpler1 opened this issue Oct 12, 2021 · 4 comments · Fixed by #896
Closed
1 task done

Lint found errors in the project; aborting build. #851

Simpler1 opened this issue Oct 12, 2021 · 4 comments · Fixed by #896
Labels
new issue An issue that hasn't yet been seen from the maintainer

Comments

@Simpler1
Copy link

Platform

  • Android
  • [] iOS
  • [] Web
  • [] Desktop (Go)
$ android/gradlew clean
$ android/gradlew build

> Task :file_picker:lint FAILED
Ran lint on variant debug: 9 issues found
Ran lint on variant release: 9 issues found
Ran lint on variant profile: 9 issues found
Wrote HTML report to file:///home/kevin/git_projects/flutter_assets/build/file_picker/reports/lint-results.html
Wrote XML report to file:///home/kevin/git_projects/flutter_assets/build/file_picker/reports/lint-results.xml
w: Detected multiple Kotlin daemon sessions at ../build/kotlin/sessions

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':file_picker:lint'.
> Lint 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:
  
  /home/user1/.pub-cache/hosted/pub.dartlang.org/file_picker-4.1.4/android/src/main/java/com/mr/flutter/plugin/filepicker/FileUtils.java:188: Error: Call requires API level 19 (current min is 16): android.provider.DocumentsContract#getDocumentId [NewApi]
                  String docId = DocumentsContract.getDocumentId(treeUri);
                                                   ~~~~~~~~~~~~~
  /home/user1/.pub-cache/hosted/pub.dartlang.org/file_picker-4.1.4/android/src/main/java/com/mr/flutter/plugin/filepicker/FileUtils.java:66: Error: Value must be ≥ 0 [Range]
                          result = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@Simpler1 Simpler1 added the new issue An issue that hasn't yet been seen from the maintainer label Oct 12, 2021
@Simpler1
Copy link
Author

The first error can be fixed by editing
~/.pub-cache/hosted/pub.dartlang.org/file_picker-4.1.4/android/build.gradle
and changing
minSdkVersion 16
to
minSdkVersion 19

@Simpler1
Copy link
Author

Simpler1 commented Oct 13, 2021

The second error can be avoided by editing
~/.pub-cache/hosted/pub.dartlang.org/file_picker-4.1.4/android/build.gradle
and adding
abortOnError false
to the lintOptions section

@miguelpruivo
Copy link
Owner

@Simpler1 this is the first time I see it reported as an issue. Increasing the minSdk to 19 could introduce breaking changes for some applications relying on the plugin.

The second one isn't an issue, but this should be related with your project I believe, otherwise would be a major issue for most of plugin users.

@AngeloAvv
Copy link
Contributor

@miguelpruivo any updates? This library is breaking my CI builds due to lint failure. I think the android linter can't understand the previously defined check regarding the android version defined before this row

Even if you targeted your project minSdkVersion to 19 or above, the linter will keep failing because the internal lint task of your library uses the minSdkVersion of the library, which is 16.

You can reproduce it by creating a new flutter project with this very dependency and then run the android gradle task lintDebug or lintRelease

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new issue An issue that hasn't yet been seen from the maintainer
Projects
None yet
3 participants