java.lang.NullPointerException(无错误信息)当尝试制作 sign apk 时

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

我正在使用 https://github.com/barteksc/AndroidPdfViewerV1 Android PdfViewer 在我的应用程序中显示 pdf。但是加入这个库之后apk的体积就变的很大了。所以我在 build.gradle(moudle :app) 文件中添加了这个。 一切正常,但是当我尝试制作签名 apk 时,才显示此错误消息。

错误信息 Error:Execution 任务“:app:lintVitalRelease”失败。

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

这是我的 build.gradle 文件

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

在您的 android { } 标签内添加这个

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

如果abortOnError false 不能解决你的问题,你可以试试这个

android {
    lintOptions {
        checkReleaseBuilds false
    }
}

它应该可以解决您的问题

如果Gastón Saillén的方法不能解决,可以把Gradle版本改成更高的版本(我的情况是把Gradle版本从4.10.1改成5.1.1)。