Android BUG - Error: Value must be ≥ 0 [Range]

2,341 阅读1分钟
* What went wrong:
Execution failed for task ':sample_java: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:

  C:\...\java\MainActivity.java:257: Error: Value must be ≥ 0 [Range]
   	displayName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
                                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~