Ошибка Android Lint: Ошибка выполнения задачи: - PullRequest
0 голосов
/ 25 июня 2019

В своем проекте я использую пакет Reaction-native-Sensual-Info и столкнулся с проблемой.Сбой сборки со следующей ошибкой Execution failed for task ':react-native-sensitive-info:lint'.

Я посмотрел онлайн и попытался добавить abortOnError false, а также checkReleaseBuilds false, но оба не сработали.

Может кто-нибудь подсказать, что я могу сделать, чтобы решить эту проблему, пожалуйста.

Спасибо R

[(> Task :react-native-sensitive-info:lint FAILED
Ran lint on variant release: 37 issues found
Ran lint on variant debug: 37 issues found
Wrote HTML report to file:///C:/Development/xxx-Retail-ReactNative/retail-native-app/node_modules/react-native-sensitive-info/android/build/reports/lint-results.html
Wrote XML report to file:///C:/Development/xxx-Retail-ReactNative/retail-native-app/node_modules/react-native-sensitive-info/android/build/reports/lint-results.xml

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-sensitive-info: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 10) were:
  C:\Development\xxx-Retail-ReactNative\retail-native-app\node_modules\react-native-sensitive-info\android\src\main\java\br\com\classapp\RNSensitiveInfo\view\Fragments\FingerprintAuthenticationDialogFragment.java:115: Error: Call requires API level 23 (current min is 18): android.content.Context#getSystemService [NewApi]
                  mActivity.getSystemService(FingerprintManager.class),
                            ~~~~~~~~~~~~~~~~
  C:\Development\xxx-Retail-ReactNative\retail-native-app\node_modules\react-native-sensitive-info\android\src\main\java\br\com\classapp\RNSensitiveInfo\view\Fragments\FingerprintAuthenticationDialogFragment.java:115: Error: Class requires API level 23 (current min is 18): android.hardware.fingerprint.FingerprintManager [NewApi]
                  mActivity.getSystemService(FingerprintManager.class),
                                             ~~~~~~~~~~~~~~~~~~
  C:\Development\xxx-Retail-ReactNative\retail-native-app\node_modules\react-native-sensitive-info\android\src\main\java\br\com\classapp\RNSensitiveInfo\view\Fragments\FingerprintUiHelper.java:35: Error: Class requires API level 23 (current min is 18): android.hardware.fingerprint.FingerprintManager.AuthenticationCallback [NewApi]
  public class FingerprintUiHelper extends FingerprintManager.AuthenticationCallback {
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



* 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 5.0.
See https://docs.gradle.org/4.8/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2m 23s

Я также добавил 'abortOnError false'.

вот build.gradle.

 lintOptions {
        abortOnError false
        //checkReleaseBuilds false
    }


subprojects {
        project.configurations.all {
            afterEvaluate {project ->
                if (project.hasProperty("android")) {
                    android {
                        compileSdkVersion rootProject.ext.compileSdkVersion
                        buildToolsVersion rootProject.ext.buildToolsVersion
                    }
                }
            }
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion rootProject.ext.buildToolsVersion
                }
            }
        }
    }

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

ext {
    compileSdkVersion = 28
    buildToolsVersion = "27.0.3"
    minSdkVersion = 18
    targetSdkVersion = 28    
}

settings.gradle

include ':react-native-sensitive-info'
project(':react-native-sensitive-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sensitive-info/android')

gradle.properties

android.useDeprecatedNdk=true
android.enableAapt2=false
android.enableJetifier=false
android.useAndroidX=false

package.json

"react-native-sensitive-info": "5.4.1",

Подскажите, пожалуйста, как это исправить

1 Ответ

0 голосов
/ 26 июня 2019

Основано на ошибке «Ошибка: класс требует API уровня 23 (текущий минимум 18)», я предлагаю изменить minSdkVersion = 18 на minSdkVersion = 23 в build.gradle.

ext {
    compileSdkVersion = 28
    buildToolsVersion = "27.0.3"
    minSdkVersion = 23
    targetSdkVersion = 28    
}
...