ChatGPT解决这个技术问题 Extra ChatGPT

':app:lintVitalRelease' error when generating signed apk

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
      }
  }
  ...
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?
stackoverflow.com/questions/43203415/… go on this page fr answer. its work for me
"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.
build/report folder is a very good tip. For me the problem was missing translations, and it was clear from the html report.
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

k
krishh

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.


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 developer.android.com/studio/write/lint
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!
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...
This must be the accepted answer. Disabling lint is not a good solution.
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.
N
N Droidev

I had this problem and solved it by adding:

lintOptions { 

    checkReleaseBuilds false

}

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


This doesn't have any other side effects on the application right?
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.
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 .."
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.
it gave white screen in my case. -1
Y
Yosidroid

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


This is way better than just ignore the errors and move on. And the HTML file is so easy to understand the problem.
i found the problem in /app/build/reports/lint-results-release-fatal.xml. thanks
Life saver. Problem solved in literally seconds, after looking at the xml file.
There is not report folder!
@roghayeh hossein if you are using kotlin, You won't find report folder. There is another way of finding your lint files. I just updated my answers, you can check it back.
R
Roberto

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


that was my problem .... add missing translations fix the problem thanks
Worked for me some translations were missing.
P
Pecolyte Wang

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!


both are files are empty for me.
A
Aveek

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
    }

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;
M
Mikhail

How to find error details

Anylyze -> Inspect Code

https://i.stack.imgur.com/j8us4.png

Then in Inspection Results you will see an error

https://i.stack.imgur.com/hm0pA.png

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


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.
A
Amit raj
***Try this***

 buildTypes {
        release {
            lintOptions {
                disable 'MissingTranslation'
                checkReleaseBuilds false
                abortOnError false
            }
            minifyEnabled false
            signingConfig signingConfigs.release
        }
    }

M
Mateusz Kaflowski

https://i.stack.imgur.com/k0opI.png


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.
Oh my god... thanks! That one saved me a lot of time! :D
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
R
Rehan Sarwar

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
}

@justColbs might be you face another issue. Post your issue with log cat may be some one guide you properly.
S
Stephen Ostermiller

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

A
Amir Hossein Ghasemi

Just find the error reason in here and fix it.

yourProject/app/build/reports/lint-results-release-fatal.xml

you should know what exact error and recertify. thank you.
I found TargetSdkVersion No Longer Supported: Google Play requires that apps target API level 26 or higher. in my log, i.e. can't set targetSdkVersion 25.
P
Panneerchelvam Piratheepan

https://i.stack.imgur.com/JATGv.png

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
}

S
Stephen Ostermiller

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>


t
tomDev

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>

K
Keshav Gera

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

Q
Quwaysim

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.


S
Sandy.....

Try below code

buildTypes {
    release {
        lintOptions {
            disable 'MissingTranslation'
            checkReleaseBuilds false
            abortOnError false
        }
        minifyEnabled false
        signingConfig signingConfigs.release
    }
}

s
someone

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

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

https://i.stack.imgur.com/UgBw2.png


Very pretty, but where is this window from please? I could not find it in Android Studio...
C
Christian Gollhardt

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
}

E
Eran Goldin

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


m
mdicosimo

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.


S
Swarnava Chakraborty

Don't disable the lint option

Check the Lint Report for error and warning

PATH:

YourAppProjectFolder\app\build\reports

Solve all error and warning:)


K
Kamal

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


Y
Yosidroid
    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


J
Jeiel Junio

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.


A
Alish Giri

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


A
Alpesh Sorathiya

If you add in app.gradle under android{

lintOptions {

    quiet true
    abortOnError false
}

}

It will get work


I think it is better to fix lints and errors, if possible, instead of skip the check
It works for me in CI/CD build.