277

I've tried to upload my apk on google play and encountered an error message: "You uploaded a debuggable APK. For security reasons you need to disable debugging before it can be published in Google Play. Learn more about debuggable APKs."

Then I wrote android:debuggable="false" in my manifest and tried again. I've encountered the same error, so I've set the build variant from my module to release and tried generated an apk again, but this time, this error is generated:

Error:Gradle: Execution failed for task ':app:lintVitalRelease'.
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
      }
  }
  ...
Samir Alakbarov
  • 1,120
  • 11
  • 21
user3716366
  • 2,781
  • 2
  • 12
  • 5
  • 50
    All answers seem to be either not to check for errors or not to abort on errors, but what about finding the problem and correcting it??? Android Studio shows no information about what is wrong... Any one was able to fix this with out ignoring errors? – Federico Alvarez Apr 19 '18 at 14:10
  • https://stackoverflow.com/questions/43203415/error-while-generating-signed-apk-when-i-use-google-map go on this page fr answer. its work for me – Halim Bezek Jul 06 '18 at 20:05
  • 6
    "but what about finding the problem and correcting it???" I thought same but I always overlooked 'Inspection Results' tab on the bottom bar and also build\report folder contents. Please check. – PravyNandas Jul 21 '18 at 12:35
  • 1
    build/report folder is a very good tip. For me the problem was missing translations, and it was clear from the html report. – Pete Aug 28 '18 at 22:36
  • on the error google give you the solution, why didn't you try this???? at first try to understand the error as well as error message – Mafujul Sep 27 '18 at 18:58
  • I did answer this question in the following link, and it is working perfect https://stackoverflow.com/questions/24098494/error-when-generate-signed-apk/52140460#52140460 – Yosidroid May 07 '19 at 12:46
  • downgrading my android gradle work for me. ( " com.android.tools.build:gradle:3.3.2 " ) – AKASH WANGALWAR Jul 15 '19 at 11:04

28 Answers28

447

I wouldn't recommend turning off the lint checks, they're there for a reason. Instead, check what the error is and fix it.

The error report is saved to [app module]/build/reports/lint-results-yourBuildName-fatal.html. You can open this file in a browser to read about the errors.

It would be nice if Gradle could make it a little more clear where the error report is generated.

krishh
  • 1,551
  • 15
  • 28
Graydyn Young
  • 5,041
  • 1
  • 17
  • 19
  • 9
    Agree, it's much better to correct the error! It is also possible to generate the report manually with `gradlew lint` or via an IDE, see https://developer.android.com/studio/write/lint – Anigif May 24 '18 at 08:49
  • 3
    yes, rright direction. Moreover errors report in that html was well described and the errors were addressed ok, so I just corrected them with ease! – CodeToLife May 26 '18 at 09:07
  • 7
    yes it's very annoying when it says `fix the issues identified by lint` but doesn't actually shows those errors or path to report... – user25 May 28 '18 at 20:17
  • 8
    This must be the accepted answer. Disabling lint is not a good solution. – slhddn Jul 05 '18 at 12:32
  • 1
    in my case the error was `MissingTranslation: Incomplete translation` - question for Google: **why isn't this shown in Android Studio??** It's called a `integrated development environment` for a reason. – Someone Somewhere Aug 26 '18 at 12:54
  • This works! I had an error in a layout where an id doesn't exist. Thanks – Crono Oct 29 '18 at 23:00
  • in my case autogenerated dimens for large and xlarge config were missing some of the values, would never find out if you did not point me where to look. Big thank you sir. – Boris Gafurov Mar 26 '19 at 14:08
  • Thank you , when I check the report I found multiple ID in one layout caused this problem – Mouaad Abdelghafour AITALI Aug 09 '19 at 18:41
  • This should be the accepted answer, I was lucky to browse the page down! Somebody should mark the answer as the good one – Ramon Dec 03 '19 at 11:03
  • running `gradlew lint --debug` in Android studio Terminal will show you the path where the error report is saved – Bosco Jan 29 '20 at 14:26
  • Thank you very much for tip. In my case I had fragment registered in Manifest as activity. Build was working fine unless I tried to sign APP. In report I was able to find exact problem. – Michal Zhradnk Nono3551 Jun 10 '20 at 09:56
  • 1
    There is not report folder! – roghayeh hosseini Aug 26 '21 at 08:48
  • No report folder, and the report folder I could find with the files are empty. – Wesley Barnes Nov 12 '21 at 19:36
  • Your answer works perfectly – Noman Shakoor Feb 16 '22 at 12:05
223

I had this problem and solved it by adding:

lintOptions { 

    checkReleaseBuilds false

}

to my build.gradle file within the android{ } section.       

Samir Alakbarov
  • 1,120
  • 11
  • 21
naile
  • 2,319
  • 1
  • 10
  • 2
  • This doesn't have any other side effects on the application right? – committedandroider Dec 15 '14 at 05:38
  • 13
    No, turning lint off will not cause any side effects on the application. Lint is a code-analysis tool and the error mentioned here caused by setting the debuggable property can be viewed in detail in the "lint-results-release-fatal.html" file in the build/outputs folder. – novas1r1 Jul 15 '15 at 13:08
  • Had trouble adding an android {} section to my top-level build.grade file; so followed some other advice and added this to my build.grade file at the level of the app, i.e. one folder further down, where the android section was already present. – Martin Zaske Sep 22 '17 at 15:27
  • 15
    *Warning:* This simply disables the lint checks. It'd be better to at least take a look on the errors before disabling them. In my case, they were about some missing strings for specific languages. Hit "Analyze" -> "Inspect code .." – Markus May 29 '18 at 14:11
  • 2
    I don't recommend this. In my case ignoring these warnings would cause crashes at run-time caused by missing resources. Please review lint-results-release-fatal.html and fix all the issues. – Paweł Nadolski Jan 24 '19 at 13:29
  • The path to `lint-results-release-fatal.html` is `app -> build -> reports` – Lal Feb 25 '19 at 20:40
  • i dont have an android section in build.gradle – jim May 11 '19 at 05:55
  • I do not recommend this because it excludes all other errors also while creating release build so please do not use this. It's better to solve error from build->reports->lint-results-release-fatal.html and solve error. – khushbu Jan 03 '20 at 10:17
  • 1
    it gave white screen in my case. -1 – Nijat Mursali Apr 21 '21 at 17:21
83

if you want to find out the exact error go to the following path in your project: /app/build/reports/lint-results-release-fatal.html(or .xml). The easiest way is if you go to the xml file, it will show you exactly what the error is including its position of the error in your either java class or xml file. Turning off the lint checks is not a good idea, they're there for a reason. Instead, go to:

    /app/build/reports/lint-results-release-fatal.html or 
    /app/build/reports/lint-results-release-fatal.xml

and fix it.

In Kotlin is different. First you need to set the following code in Android section of build.gradel of the app folder.

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

Then run lint from the IDE (Analyze > Inspect Code) or from the command line as follows.

      $ ./gradlew lintDebug

...

The output prints the location of the lint-baseline.xml file within app folder but sometimes within app/src folder as well /app/lint-baseline.xml

Yosidroid
  • 2,053
  • 16
  • 15
51

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

Roberto
  • 4,524
  • 1
  • 38
  • 30
43

In case that you may trying to locate where the problem is, I found mine in the following path of my project: /app/build/reports/lint-results-release-fatal.html(or .xml).

Hope this helps!

Pecolyte Wang
  • 431
  • 4
  • 2
38

I have faced same issue when creating signed apk from android studio. I just change little bit change on build.gradle file inside android {}

lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
Aveek
  • 849
  • 1
  • 12
  • 28
Dhruv Raval
  • 4,946
  • 3
  • 29
  • 34
  • This worked for me. I had a similar issue. Execution failed for task ‘:app:lint***Release’. > org.picocontainer.MutablePicoContainer.registerComponentInstance(Ljava/lang/Object;)Lorg/picocontainer/ComponentAdapter; – Nelson Ramirez Nov 17 '17 at 19:29
32

How to find error details

Anylyze -> Inspect Code

enter image description here

Then in Inspection Results you will see an error

enter image description here

In my case build failed due to unresolved javadoc reference in Google IAP

Mikhail
  • 2,612
  • 3
  • 22
  • 37
  • 4
    This should be the accepted answer. To all the people who suggested to disable the lint checking, that is just a work around. It is still better to fix the error than skip it. Skipping lint checks should only be done in very specific cases and not all the time. AGAIN, THAT SHOULD BE DONE RARELY OR EVEN NOT AT ALL. – Archie G. Quiñones Mar 15 '19 at 05:39
22
***Try this***

 buildTypes {
        release {
            lintOptions {
                disable 'MissingTranslation'
                checkReleaseBuilds false
                abortOnError false
            }
            minifyEnabled false
            signingConfig signingConfigs.release
        }
    }
Amit raj
  • 390
  • 3
  • 8
18

You can find more info choosing assemble from gradle build tab:enter image description here

EDIT 2022:

You can run after clicking elephant button:

gradle assembleDebug
Mateusz Kaflowski
  • 2,221
  • 1
  • 29
  • 35
  • 5
    this is the actual answer, go to the assemble in app, in gradle window and run it by double clicking, Android studio will tell you exactly what it was poping. – Wajid Nov 21 '18 at 18:52
  • 1
    Oh my god... thanks! That one saved me a lot of time! :D – thinklinux Apr 19 '19 at 12:52
  • I got, `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 }` and i added it but i got the same error in every time i build a release – Oliver D Nov 29 '19 at 17:02
12

Try These 3 lines in your app.gradle file.

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
}
Rehan Sarwar
  • 994
  • 8
  • 20
9

This worked for me, I just modified my BuildTypes like this:

buildTypes {
    release {
        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
            }
        }
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
9

enter image description here

Add this inside android {} build.gradle(Module:App)

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

My problem was a missing translation. I had a settings.xml that was not translated as it was not needed, so I had to add "translatable="false" to the strings:

<string translatable="false" name="stringname">This string doesn't need translation</string>

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Harsh Masand
  • 121
  • 1
  • 4
8

Just find the error reason in here and fix it.

yourProject/app/build/reports/lint-results-release-fatal.xml
Amir Hossein Ghasemi
  • 20,623
  • 10
  • 57
  • 53
7

My problem was a missing translation. I had a settings.xml that was not translated as it was not needed, so I had to add "translatable="false" to the strings:

<string translatable="false" name="stringname">This string doesn't need translation</string>
tomDev
  • 5,620
  • 5
  • 29
  • 39
5

Solve this Issue Using this in build.gradle (app) File Inside main Android { inside }

  buildTypes {
      //  crunchPngs false // or true   when png error
        release {
            lintOptions {
                checkReleaseBuilds false
                abortOnError false
            }
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
Keshav Gera
  • 10,807
  • 1
  • 75
  • 53
4

As many people have suggested, it is always better to try and fix the error from the source. check the lint generated file

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

read the file and you will be guided to where the error is coming from. Check out mine: the error came from improper view constraint.

Quwaysim
  • 351
  • 3
  • 11
3

Try below code

buildTypes {
    release {
        lintOptions {
            disable 'MissingTranslation'
            checkReleaseBuilds false
            abortOnError false
        }
        minifyEnabled false
        signingConfig signingConfigs.release
    }
}
Sandy.....
  • 2,833
  • 2
  • 15
  • 26
2

Windows -> references ->Android->lint error checking.

un tick Run full error.......

enter image description here

someone
  • 6,577
  • 7
  • 37
  • 60
2

Go to build.gradle(Module:app)

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
}
Christian Gollhardt
  • 16,510
  • 17
  • 74
  • 111
Azmat Ali
  • 554
  • 5
  • 7
1

Remove that statement from your manifest altogether, Eclipse will handle that for you on the fly.

Eran Goldin
  • 980
  • 12
  • 21
1

In my case the problem was related to minimum target API level that is required by Google Play. It was set less than 26.

Issue disappeared when I set minimum target API level to 26.

mdicosimo
  • 724
  • 7
  • 19
1
    lintOptions {
      checkReleaseBuilds false
      abortOnError false
    }

The above code can fix the problem by ignoring it, but it may result in crashing the app as well.

The good answer is in the following link:

Error when generate signed apk

Yosidroid
  • 2,053
  • 16
  • 15
1

Don't disable the lint option

Check the Lint Report for error and warning

PATH:

YourAppProjectFolder\app\build\reports

Solve all error and warning:)

0

You should add the code in project level gradle file for generating apk overwriting over errors

Kamal
  • 245
  • 2
  • 3
0

This problem came to me when I updated the Android Gradle Plugin Version to 4.0.1 and the Gradle version to 6.1.1.

If someone is in a hurry, just downgrade the Gradle Plugin Version to 3.6.3 and the Gradle version to 5.6.4. It worked for me.

Jeiel Junio
  • 129
  • 1
  • 10
0

Upgrading gradle distribution url to,

// android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

and upgrading buildscript -> dependencies -> classpath to,

// android/build.gradle
classpath 'com.android.tools.build:gradle:7.0.0'

fixed the issue for me

Alish Giri
  • 1,855
  • 18
  • 21
-1

If you add in app.gradle under android{

lintOptions {

    quiet true
    abortOnError false
}

}

It will get work

Alpesh Sorathiya
  • 510
  • 3
  • 13