jesususo
jesususo

Reputation: 1421

Lint found fatal errors while assembling a release target

383/5000 I have an app that gives me compilation errors when I change it to release mode to upload it to the play store

I've tried analyzing-inspecting code and I do not have any error.

I have also tried the compilation sugestion in the build build gradle and it does not give an error, but when I try to install the apk it gives me an error: "the APK failed to install. Error: Could not stop error string"

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:lintVitalRelease'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.api.GradleException: Lint found fatal errors while assembling a release target.

To proceed, either fix the issues identified by lint, or modify your build script as follows:
...
android {
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}
...
    at com.android.tools.lint.gradle.LintGradleExecution.abort(LintGradleExecution.java:199)
    at com.android.tools.lint.gradle.LintGradleExecution.runLint(LintGradleExecution.java:263)
    at com.android.tools.lint.gradle.LintGradleExecution.lintSingleVariant(LintGradleExecution.java:359)
    at com.android.tools.lint.gradle.LintGradleExecution.analyze(LintGradleExecution.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.android.tools.lint.gradle.api.ReflectiveLintRunner.runLint(ReflectiveLintRunner.kt:38)
    at com.android.build.gradle.tasks.LintBaseTask.runLint(LintBaseTask.java:87)
    at com.android.build.gradle.tasks.LintPerVariantTask.lint(LintPerVariantTask.java:41)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:780)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:747)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    ... 32 more

Upvotes: 142

Views: 132518

Answers (19)

mathematics-and-caffeine
mathematics-and-caffeine

Reputation: 2197

2025 Solution

The lint report is now located at: myproject\app\build\intermediates\lint_vital_intermediate_text_report\release

Upvotes: 5

Abhijith Brumal
Abhijith Brumal

Reputation: 1772

The best approach is to add the code below to your app-level build.gradle

  android {
      lint {
            baseline = file("lint-baseline.xml")
        }
    }

Then switch to the project view in Android Studio IDE enter image description here

You could see the lint file under the app directory after building the project. enter image description here

Open the file and you will see the issues below, enter image description here

Copy the issue location -> fix the issues -> delete the file and rebuild your project.

Delete the lint file to avoid past history lint errors.

Tada!

Upvotes: 1

Zhou Haibo
Zhou Haibo

Reputation: 2078

Meet this problem today, My Android Studio says lintOptions is deprecated, try this new format.

lint {
  abortOnError = false
}

Upvotes: 0

Fatih Santalu
Fatih Santalu

Reputation: 4701

  1. You can right click on a folder or a file and use Analyze > Inspect Code menu to manually run inspections. The results appear in the Inspection Results window. This way you can view and fix the real issues.

  2. You can still view them from app\build\reports\lint-results-release-fatal.html file without using aforementioned manual inspection menu.

  3. Although it's not recommended you can also suppress the lint warnings by adding below code into your build.gradle as Android Studio suggests. But keep in mind that this will not fix any real issues.

android {
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}

Upvotes: 250

For me I found the error mentioned in this path app\build\intermediates\lint_vital_intermediate_text_report\release\lint-results-release.txt

noting that changing Ture to false in the below code is only a work around but will not solve the real problem and you might face troubles in production.

android {
lintOptions {
heckReleaseBuilds true          
            abortOnError true
        }

Upvotes: 0

amir mahdi
amir mahdi

Reputation: 13

I had same problem in generate Apk process . this showing errors process is improved in new version of gradle .I updated my gradle version to the last version then generated it again .it Showed Fatal Error in my Xml codes in best way.

Upvotes: 0

Rehan Khan
Rehan Khan

Reputation: 1291

Add this to build.gradle(Module: AppName)

below

android {

these lines

lintOptions{
    checkReleaseBuilds false
}

above these lines

compileSdkVersion 31
defaultConfig {
    applicationId "com.example.myapplication"
    minSdkVersion 21
    targetSdkVersion 31
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}

}

Upvotes: 5

basaveshwar lamture
basaveshwar lamture

Reputation: 601

I know there are plenty of answers given in this thread already, this is for those who want to know the issue. This error generally pops up because of XML/Layout/Resource file errors.
To solve this just recheck your layouts by either manually or mentioned methods in the above-given answers
I'm sure you'll find the root of cause...

Upvotes: 0

Shawn Muktadir
Shawn Muktadir

Reputation: 149

I faced the similiar issue and followed this way Analyze > Inspect Code. In my case it was the xml issues.

Upvotes: 5

Cihat Şaman
Cihat Şaman

Reputation: 4834

I had the same issue and followed this way to find the error and fix it. Analyze > Inspect Code. After that I found that the current targetSdkVersion was not supported. So I increased targetSdkVersion in the default config and that is how it was fixed.

Upvotes: 0

jmk
jmk

Reputation: 121

For me, the results file lint-definite-release.xml was located at app/build/intermediates/lint_vital_partial_results/release/out. I'm using Android Studio 2020.3.1 Patch 4.

Upvotes: 9

behza_d
behza_d

Reputation: 25

as I see you are trying to have a bundle or any kind of version edition of your newly edited app, but here you have to pay attention to the minimumsdk and target sdk and some other settings in your app which may differ from the last android studio and play store standards so you have to edit them and if needed change them, but these kind of error are located in a file in the below log or report folder it is html base and try to see it in a browser the file is in this directory in your project: app\build\reports try to open it by a browser, it will help you and press what is preventing you from generating a bundle or app with a signature encrypted.

Upvotes: 0

Antonio Karanfiloski
Antonio Karanfiloski

Reputation: 39

After a while I find solution for my problem. Just check for differences between strings.xml(for different languages - if you have)

Upvotes: 2

Talha Shahab
Talha Shahab

Reputation: 302

This works for me

lintOptions { 
    checkReleaseBuilds false
}

Add this code into the build.gradle file within android {} section

Upvotes: 26

Arda Kaplan
Arda Kaplan

Reputation: 1758

You can find out details in your app path

 /YOUR_APPLICATION/app/build/reports/ 

enter image description here

in this folder, there is a HTML document that describes the error.

For more information, you can visit the page that i find a solution.

https://dominoc925.blogspot.com/2018/08/how-to-find-cause-of-lint-error-while.html

Upvotes: 112

3.dayma
3.dayma

Reputation: 97

For me i checked the errors in the xml and html files in /APPLICATION/app/build/reports Then i fixed all i could fix and for the rest i suppressed them by adding to my build.gradle the code below:

android {
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}

This prevented android studio from aborting the build because of the remaining errors

Upvotes: 5

Aamir Shahzad
Aamir Shahzad

Reputation: 6834

File > Invalid Caches/Restart has fixed the issue for me. I am just getting started with the Android but I thought to try this before trying what's mentioned above and it worked.

Upvotes: -1

Asad Ali Choudhry
Asad Ali Choudhry

Reputation: 5271

Here I have written an article on all possible solutions to resolve Lint found fatal errors issue.

Generally, you can resolve it in the following way:

Android studio shows all build errors in html & xml file present at the following link. Just open that file in your browser, check the error and fix it.

/YOUR_APPLICATION/app/build/reports/lint-results-release-fatal.html

enter image description here

Sample Error

enter image description here

Upvotes: 82

kksal55
kksal55

Reputation: 598

Make sure you defined all the translations in all the string.xml files in your application.

Upvotes: 6

Related Questions