Search code examples
androidsplitapk

java.lang.NullPointerException (no error message) when try to make sign apk


I am using https://github.com/barteksc/AndroidPdfViewerV1 Android PdfViewer to showing pdf in my app. but after adding this library The size of the apk has become very big. so I have added this in build.gradle(moudle :app) file. everything is ok but when I try to make a sign apk Only then show this error message.

Error Message Error:Execution failed for task ':app:lintVitalRelease'.

Could not delete old D:\Google Play\exampleapp\app\build\reports\lint-results-release-fatal.html

and this is my build.gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.me"
        minSdkVersion 14
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled true
//            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    splits {
        abi {
            enable true
            reset()
            include 'x86_64', 'x86', 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips'
            universalApk false
        }
    }
}

ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, mips: 4, 'x86': 5, 'x86_64': 6]
import com.android.build.OutputFile
android.applicationVariants.all { variant ->
    // assign different version code for each output
    variant.outputs.each { output ->
        output.versionCodeOverride =
                project.ext.versionCodes.get(output.getFilter(OutputFile.ABI)) * 1000000 + android.defaultConfig.versionCode
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.android.support:support-v4:27.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    compile 'com.google.android.gms:play-services-ads:11.8.0'
    compile 'uk.co.chrisjenx:calligraphy:2.3.0'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'com.github.barteksc:android-pdf-viewer:1.6.0'
}

Solution

  • inside your android { } tag just add this

        // This is important, it will run lint checks but won't abort build
    android {   
       lintOptions {
              abortOnError false
          }
    }
    

    if abortOnError false will not resolve your problem, you can try this

    android {
        lintOptions {
            checkReleaseBuilds false
        }
    }
    

    it should solve your problem