138

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
jesususo
  • 1,381
  • 2
  • 8
  • 5

19 Answers19

246
  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
    }
}
Amir Fo
  • 5,163
  • 1
  • 43
  • 51
Fatih Santalu
  • 4,641
  • 2
  • 17
  • 34
  • 17
    Concur. It's amazing that even the latest Android Studio doesn't have a link to this after failing a Build due to lint, it simply shows a code snippet to DISABLE the errors.... !!!? – BjornW Sep 10 '18 at 16:06
  • 1
    @BjornW be sure they will fix it in the future. Just give them some time, you can see the only tip of the iceberg of the work, fixes, and improvements they do in each release. They have to catch up with all Google's new APIs every year and keep improving the IDE. Actually, the Android Studio currently is one of the best IDEs out there. – Kirill Karmazin Feb 07 '19 at 17:04
  • 2
    Nothing against you @Kirill, but this aged liked milk. How many years does it take to fix this simple lint rule? – jack Feb 10 '21 at 21:48
  • 5
    There is no `app\build\reports\` folder in my Android Studio, maybe they changed the path in Arctic Fox 2020.3.1? – rubo77 Dec 08 '21 at 14:01
  • Where is the "Analyze" button??? – Amir Fo Nov 26 '22 at 09:53
112

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

Arda Kaplan
  • 1,720
  • 1
  • 15
  • 23
82

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

yivi
  • 42,438
  • 18
  • 116
  • 138
Asad Ali Choudhry
  • 4,985
  • 4
  • 31
  • 36
26

This works for me

lintOptions { 
    checkReleaseBuilds false
}

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

Talha Shahab
  • 302
  • 4
  • 5
8

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.

jmk
  • 111
  • 2
  • 4
7

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

kksal55
  • 500
  • 7
  • 14
6

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

3.dayma
  • 99
  • 1
  • 5
6

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
}

}

Rehan Khan
  • 1,031
  • 13
  • 10
  • Lint is likely failing for a reason, I would not recommend simply force ignoring the check like this. A better solution is to check the lint report as in @Lukas Niessen answer – AtomicStrongForce Oct 06 '22 at 21:42
5

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

Shawn Muktadir
  • 140
  • 2
  • 7
4

In my case the lint report was located at: myproject\app\build\intermediates\lint_vital_intermediate_text_report\release

mathematics-and-caffeine
  • 1,664
  • 2
  • 15
  • 19
2

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

0

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.

behza_d
  • 15
  • 3
  • Please provide a detailed explanation to your answer, in order for the next user to understand your answer better. – Elydasian Jul 23 '21 at 12:12
0

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.

Cihat Şaman
  • 3,674
  • 4
  • 14
  • 24
0

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...

0

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.

DharmanBot
  • 1,066
  • 2
  • 6
  • 10
amir mahdi
  • 13
  • 3
0

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
        }
0

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

lint {
  abortOnError = false
}
Zhou Haibo
  • 1,681
  • 1
  • 12
  • 32
0

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!

Abhijith Brumal
  • 1,652
  • 10
  • 14
-1

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.

Aamir Shahzad
  • 6,683
  • 8
  • 47
  • 70