其他分享
首页 > 其他分享> > android – 原因:buildOutput.apkData不能为null

android – 原因:buildOutput.apkData不能为null

作者:互联网

当我尝试在我的手机中的模拟器中运行’app’时,使用Kotlin的我的Android应用程序抛出此异常.当我构建我的项目时,它运行良好,没有错误.

我在用:

> SDK 28(Android 9.0(Pie))
> Gradle 5.1.1
> Gradle Plugin 3.5.0-alpha03
> Kotlin 1.3.10
> Java 1.8.0_151
> OSX 10.13.2

    org.gradle.internal.exceptions.LocationAwareException: buildOutput.apkData must not be null
        at org.gradle.initialization.exception.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:99)
        at org.gradle.initialization.exception.DefaultExceptionAnalyser.collectFailures(DefaultExceptionAnalyser.java:65)
        at org.gradle.initialization.exception.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:39)
        at org.gradle.initialization.exception.StackTraceSanitizingExceptionAnalyser.transform(StackTraceSanitizingExceptionAnalyser.java:29)
        at org.gradle.initialization.DefaultGradleLauncher.finishBuild(DefaultGradleLauncher.java:194)
        at org.gradle.initialization.DefaultGradleLauncher.finishBuild(DefaultGradleLauncher.java:141)
        ...
    Caused by: java.lang.IllegalStateException: buildOutput.apkData must not be null
        at com.android.build.gradle.internal.ide.EarlySyncBuildOutput$Companion$load$2.invoke(EarlySyncBuildOutput.kt:103)
        at com.android.build.gradle.internal.ide.EarlySyncBuildOutput$Companion$load$2.invoke(EarlySyncBuildOutput.kt:67)
        at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:174)
        at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:691)
        at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:721)
        at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:712)
        ...

解决方法:

点击构建 – >清洁项目

然后构建 – >制作项目

在gradle 3.5.0-alpha3上测试(项目gradle)

classpath 'com.android.tools.build:gradle:3.5.0-alpha03'

标签:android,mobile,apk,kotlin,mobile-application
来源: https://codeday.me/bug/20190611/1215513.html