web-dev-qa-db-fra.com

Gradle build lintVitalRelease NullPointerException

Mise à jour Android Studio de 3.0 Canary 3 à Beta 2, et le plugin Gradle d'Alpha 5 à Beta 2. Le débogage se construit très bien, mais lorsque vous essayez de générer un APK signé pour un type de version, cette erreur persiste. J'ai essayé de supprimer le dossier .gradle, le dossier .idea, les caches et redémarrages invalides et le nettoyage gradlew.

14:16:32.483 [ERROR] [system.err] Note: Recompile with -Xlint:deprecation for details.
14:16:32.483 [ERROR] [system.err] Note: Some input files use unchecked or unsafe operations.
14:16:32.483 [ERROR] [system.err] Note: Recompile with -Xlint:unchecked for details.
14:16:37.434 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
14:16:37.434 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':app:lintVitalRelease'.
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Java.lang.NullPointerException (no error message)
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:lintVitalRelease'.
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:100)
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.Java:70)
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.Java:63)
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.Java:54)
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.Java:58)
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.Java:88)
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.Java:52)
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.Java:52)
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.Java:54)
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.Java:43)
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.Java:34)
14:16:37.435 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.Java:248)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:336)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:328)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:197)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:107)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:241)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:230)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.Java:124)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.Java:80)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:105)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:99)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.Java:625)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.Java:580)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.Java:99)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.Java:63)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.Java:46)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.Java:55)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: Java.lang.NullPointerException
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.scope.BuildOutput.getOutputPath(BuildOutput.Java:222)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.scope.BuildOutputs.lambda$load$2(BuildOutputs.Java:243)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.scope.BuildOutputs.load(BuildOutputs.Java:245)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.scope.BuildOutputs.load(BuildOutputs.Java:184)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.scope.BuildOutputs.load(BuildOutputs.Java:140)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.ide.BuildOutputsSupplier.lambda$get$1(BuildOutputsSupplier.Java:55)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.google.common.collect.ImmutableList.forEach(ImmutableList.Java:397)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.ide.BuildOutputsSupplier.get(BuildOutputsSupplier.Java:50)
14:16:37.436 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.ide.BuildOutputsSupplier.get(BuildOutputsSupplier.Java:35)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.ide.AndroidArtifactImpl.getOutputs(AndroidArtifactImpl.Java:135)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.LintGradleProject$AppGradleProject.<init>(LintGradleProject.Java:206)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.LintGradleProject$AppGradleProject.<init>(LintGradleProject.Java:192)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.LintGradleProject$ProjectSearch.getProject(LintGradleProject.Java:949)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.LintGradleProject$ProjectSearch.getProject(LintGradleProject.Java:785)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.LintGradleClient.createLintRequest(LintGradleClient.Java:193)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.tools.lint.LintCliClient.run(LintCliClient.Java:151)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.internal.LintGradleClient.run(LintGradleClient.Java:209)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.tasks.Lint.runLint(Lint.Java:359)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.tasks.Lint.lintSingleVariant(Lint.Java:329)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.Android.build.gradle.tasks.Lint.lint(Lint.Java:134)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.Java:73)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.Java:141)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.Java:134)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.Java:121)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.Java:731)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.Java:705)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.Java:122)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:336)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:328)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:197)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:107)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.Java:111)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:92)
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   ... 27 more
14:16:37.437 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
14:16:37.438 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
14:16:37.438 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
14:16:37.438 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] 
14:16:37.438 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 19s
13
mDroidd

Option 1. Recommandé. Résolvez le problème.

Corrigez le problème lui-même au lieu de le désactiver.

Pour ce faire, accédez à app/build/outputs/lint-results-release-fatal.html faites un clic droit dessus et sélectionnez ouvrir dans le navigateur. Corrigez l'erreur détaillée qu'il fournit. J'ai fait cela, corrigé mon erreur et maintenant il compile la version apk.

Option 2. Désactiver l'inspection.

org.gradle.api.tasks.TaskExecutionException: l'exécution a échoué pour la tâche ': app: lintVitalRelease'.

Vous devez ajouter checkReleaseBuilds dans build.gradle section.

  Android {
    lintOptions { 
        checkReleaseBuilds false // Add this
        abortOnError false
    }
}

Alors Clean-Rebuild-Run.

31
IntelliJ Amiya

Comment savoir ce qui ne va pas dans votre code?

C'est simple. Ouvert lint-results-release-fatal.html fichier dans le navigateur et vous verrez ce qui ne va pas avec votre code. Dans mon cas, c'était une traduction manquante. Lorsque j'ai ouvert le lint-results-release-fatal.html dans le navigateur, cela ressemblait à ceci.

enter image description here

Comment ouvrir lint-results-release-fatal.html dans le navigateur?

Accédez à ce chemin apps/build/reports/lint-results-release-fatal.html cliquez avec le bouton droit et sélectionnez l'option Ouvrir dans le navigateur . Si vous ne le trouvez pas dans votre projet, vous pouvez changer la perspective en Projet .

Si vous êtes toujours confus. Suivez ensuite ces 3 étapes.

1) Changer la perspective en projet

enter image description here

2) Allez dans apps/build/reports/lint-results-release-fatal.html

enter image description here

3) Faites un clic droit et sélectionnez "Ouvrir dans l'option du navigateur"

Traduction manquante

Comme Edward a mentionné que 9/10 fois c'est dû à une traduction manquante. Dans mon application, j'ai ajouté une prise en charge multilingue en créant des fichiers string.xml alternatifs. Mais j'ai oublié de l'ajouter dans d'autres langues. J'ai reçu cette erreur lorsque j'essayais de créer un APK signé . Je n'avais aucune idée de ce qui s'est passé jusqu'à ce que j'ouvre le lint-results-release-fatal.html(Rapport d'erreur). Donc, en termes profanes, c'est comme passer par un rapport d'erreur. Qui vous indique la cause profonde, la source et une solution possible. Vous pouvez également ouvrir la version XML du rapport d'erreur qui est lint-results-release-fatal.xml.

Le rapport d'erreur le montre clairement.

<string name="action_settings">Settings</string>

enter image description here

1
Rohit Singh