My android application using Kotlin is throwing this exception when I try to Run 'app' in the emulator o in my cellphone. When I build my project it runs well, with no errors.
I am using:
- 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)
...
This issue happens after update my Android studio v3.4 to v3.5 Now, it is working fine
I fixed this issue by deleting debug/output.json and release/output.json files
Android Studio 3.5 compilesdkVersion 28
apk generating working
I was using Android Studio 3.5 beta 2 and I was having the exact same error but only on my release build. After trying every other solution I found, the only way I was able to compile again was to go back to Android Studio 3.4.
The Simple solution that I found is. During the signing of the apk after entering the signing credentials when you navigate to the next screen then it will ask for the destination folder just change the default path.
Let’s assume current destination path is
c:\user\folder\project\app
change it to
c:\user\folder\project
then it will generate the signed apk successfully.
It works for me:
delete build folder from your project manually.
in terminal of android studio type this command
if windows user
if linux user
Generate Signed APK for debug, and then you can generate signed APK for release.
This issue is happens usually when you are running multiple android studio window with different projects.
The solution is
please ref screen shot attached