Menu

#690 Gradle build fails

1.0
closed
nobody
None
2020-04-06
2020-02-17
No

The current (and last released) version do not build cleanly. I’d love to contribute, but this is keping me from it…

To reproduce:

  1. Clone the git repo.
  2. Change to the directory to which you cloned the source repo.
  3. Run ./gradlew build

Expected result:

Build runs and finishes without errors.

Actual result:

Build fails with an Androit lint error:

Execution failed for task ':app: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
      }
  }
  ...

  The first 3 errors (out of 548) were:
  /home/michael/src/opencamera/app/src/main/java/net/sourceforge/opencamera/StorageUtils.java:530: Error: Try-with-resources requires API level 19 (current min is 15) [NewApi]
              try( Cursor cursor = context.getContentResolver().query(uri, null, null, null, null) ) {
                   -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/michael/src/opencamera/app/src/main/res/values/strings.xml:15: Error: "choose_another_folder" is not translated in "it" (Italian) [MissingTranslation]
      <string name="choose_another_folder">Choose another folder</string>
              -~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/michael/src/opencamera/app/src/main/res/values/strings.xml:37: Error: "cancelled_repeat_mode" is not translated in "el" (Greek) [MissingTranslation]
      <string name="cancelled_repeat_mode">Cancelled repeat mode</string>
              -~~~~~~~~~~~~~~~~~~~~~~~~~~~

Versions tested:

  • 1.47.3 (as per tag)
  • master@e795c3ca

Discussion

  • Mark

    Mark - 2020-02-17

    It looks like it's treating the lint errors as compilation errors. This doesn't happen for me - I'm not sure if there's an Android Studio setting for this? I couldn't find one though. I'm on Android Studio 3.5.3.

    If nothing else, the suggestion to add "abortOnError false" to the lintOptions should work?

    (I do review the lint warnings/error each release, but they shouldn't be compilation errors; although having said that I missed the "Try-with-resources" one - it's fine as that method is only called on Android 5+ codepaths, but I'll look at fixing up the code to reflect that.)

     
  • Michael von Glasow

    I build straight from the command line, which may explain the different behavior. Haven’t followed up on this, but the same fix you suggested worked in a different project. Any reasons not to add it to the build script? I guess the majority of the folks who build from source don’t want to deal with the build chain complaining about non-critical errors in upstream code, and those who specifically want to fix lint errors hopefully know how to chang this setting…

     
    • Mark

      Mark - 2020-04-06

      I've made this change now.

       
  • Mark

    Mark - 2020-04-06
    • status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel