Error: Execution failed for task ':app: lintVitalRelease' any one can solve it?

JavaAndroid

Java Problem Overview


Why I get this error I try to clean and rebuild application and make application release true and I get same error

> Error:Execution failed for task ':app:lintVitalRelease'. > java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "x.x.x"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 95
        versionName '5'

        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }

}

Java Solutions


Solution 1 - Java

To find out why lint fails do this:

  1. Run lintVitalRelease

You can do it from Gradle window

enter image description here

  1. Under Run tab, you will see error logs

enter image description here

For me, it was wrong constraint in ConstraintLayout XML.

enter image description here

Solution 2 - Java

Based off this Post

Edit: I removed the link because the thread is no longer there

What you need to do is add this chunk of code to your build.gradle file in the android{} section

lintOptions { 
    checkReleaseBuilds false
}

So like this

android {
    ...
    lintOptions {
        checkReleaseBuilds false
    }
}

Update:

Here is another post talking about a similar problem. It seems like there are various reasons this error can occur. While disabling the checkReleaseBuilds will work. It's recommended to find what the problem is and fix it. Most common error seems to be missing translations in the strings.xml file.

I recommend checking out this post for more help

https://stackoverflow.com/questions/24098494/error-when-generate-signed-apk

Solution 3 - Java

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.

src: https://stackoverflow.com/a/50239165/365229

Solution 4 - Java

lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

Solution 5 - Java

Open your build.gradle file and add the code below under android:

android {

    lintOptions { 
      checkReleaseBuilds false 
    }

Solution 6 - Java

Simple and Working

Solution 1

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

Solution 2

android {
        lintOptions {
            checkReleaseBuilds false
            abortOnError false
        }
    }

Solution 3

 android {
        lintOptions {
           disable 'MissingTranslation'
           abortOnError false
        }
    }

> Notes: There are two type uses option ->

1

 lintOptions {
        //TODO
    }

2

android {
        lintOptions {
           // TODO
        }
    }

Thank You

Solution 7 - Java

File > Invalidate Caches/Restart... worked for me.

Solution 8 - Java

In my opinion don't use "checkReleaseBuilds false". This broke my whole release build and I only saw a white screen.

A current workaround is running:

flutter run --profile
flutter run --debug
flutter run --release

Currently that's the only thing that worked for me. There is an open issue here: https://issuetracker.google.com/issues/158753935

Solution 9 - Java

Make sure to have jcenter() in both buildscript and allprojects in your build.gradle android{} section

Solution 10 - Java

I was also getting an error like

         > Failed to transform '/Users/michaelbui/Projects/counter/build/app/intermediates/flutter/debug/libs.jar' using Jetifier. Reason: FileNotFoundException, message: /Users/michaelbui/Projects/counter/build/app/intermediates/flutter/debug/libs.jar (No such file or directory). (Run with --stacktrace for more details.)

while building the app after the latest update, but then I disabled the lint task in android/app/build.gradle

lintOptions {
    disable 'InvalidPackage'
    checkReleaseBuilds false
}

and this worked for me.

Solution 11 - Java

In my case there was some typos in the manifest that caused the error, just corrected them and it compiled

Solution 12 - Java

In my case it was happening because I was using an invalid(not existing) id to constraint a view, and when I tried to create a build, it gave me the error. What you can do is execute task,

./gradlew assembleRelease --stacktrace

This will give you the following options,

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

If you choose,

checkReleaseBuilds false

It will not check for errors in the release build and create a build,

and if you choose,

abortOnError false

It will create a build, and as well list down the error(s).

This way you can actually correct the errors.

Solution 13 - Java

I had some missing jars and behind a corporate firewall and there was an attempt to download them during lintVitalRelease. I disconnected from VPN, re-run, which downloaded the missing jars and all returned to normal.

I knew it has to be something like that because other answers mention where error reports are generated but I had nothing generated there so it was stuck somewhere for me.

Solution 14 - Java

If you have tried everything on Google but still can't build the release. You can follow my approach:

Firstly, If the Android Studio error log contains the phrase "debug/libs.jar", then you need to build --debug then --release:

flutter build apk --debug
flutter build apk --release

What if "profile/libs.jar" appears , build --profile then --release:

flutter build apk --profile
flutter build apk --release

If there is an error when building debug or profile, then you continue to find that error on Google and fix it. In my case I had to remove the permission_handler library because it was causing the error.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionelpatrue diabView Question on Stackoverflow
Solution 1 - JavaIlia GrabkoView Answer on Stackoverflow
Solution 2 - JavanickcView Answer on Stackoverflow
Solution 3 - JavaBehrouz.MView Answer on Stackoverflow
Solution 4 - JavaMakvinView Answer on Stackoverflow
Solution 5 - JavaEmmanuel AmetepeeView Answer on Stackoverflow
Solution 6 - JavaKumar SantanuView Answer on Stackoverflow
Solution 7 - JavaKamran RiyazView Answer on Stackoverflow
Solution 8 - Javanovas1r1View Answer on Stackoverflow
Solution 9 - JavaMing AivoView Answer on Stackoverflow
Solution 10 - JavaAnshul KatariaView Answer on Stackoverflow
Solution 11 - JavaCramos50View Answer on Stackoverflow
Solution 12 - JavaAnubhavView Answer on Stackoverflow
Solution 13 - JavaSilviu BurceaView Answer on Stackoverflow
Solution 14 - JavaDoan BuiView Answer on Stackoverflow