원인 : buildOutput.apkData가 널이 아니어야합니다.
Kotlin을 사용하는 안드로이드 응용 프로그램이 휴대폰의 에뮬레이터에서 '앱'을 실행하려고하면이 예외가 발생합니다. 프로젝트를 빌드하면 오류없이 잘 실행됩니다.
나는 사용하고있다 :
- SDK 28 (Android 9.0 (Pie))
- 그레들 5.1.1
- 그레들 플러그인 3.5.0-alpha03
- 코 틀린 1.3.10
- 자바 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)
...
클릭 Build
->Clean Project
그런 다음 Build
->Make Project
gradle 3.5.0-alpha3, -alpha5 및 3.4.0 (프로젝트 gradle)에서 테스트되었습니다.
classpath 'com.android.tools.build:gradle:3.5.0-alpha03'
Android Studio 3.5 업데이트의 경우 (APK 서명 문제)
1 단계 : ' 대상 폴더 '위치를 수정하여이 문제를 해결했습니다 .
전에
c:\user\folder\project\app
후
c:\user\folder\project\apk
Android Studio 3.4 업데이트
1 단계 : Android Studio 3.4 를 업데이트 한 후에 는 앱 수준에서 모듈 또는 라이브러리에 사용 된 모든 종속성을 추가해야합니다 build.gradle
.
2 단계 : 프로젝트 정리 (빌드> 프로젝트 정리)
3 단계 : 프로젝트 재 구축 (빌드> 프로젝트 재 구축)
이제 프로젝트가 완벽하게 컴파일됩니다.
안드로이드 스튜디오 3.5
디버그 빌드는 오류없이 완료됩니다. 서명 된 .apk를 만드는 동안 동일한 오류가 발생합니다.
buildOutput.apkData must not be null
내가 찾은 간단한 해결책은 다음 화면으로 이동할 때 서명 자격 증명을 입력 한 후 APK를 서명하는 동안 대상 폴더가 기본 경로를 변경하도록 요청합니다.
현재 목적지 경로가
c : \ 사용자 \ 폴더 \ 프로젝트 \ 앱
로 변경
c : \ 사용자 \ 폴더 \ 프로젝트 \
그런 다음 서명 된 apk를 성공적으로 생성합니다.
내 릴리스 버전에 대해 "서명 된 APK 생성"을 시도 할 때도이 오류가 발생했습니다. 위의 모든 방법을 시도했지만 불행히도 아무도 나를 위해 일하지 않았습니다.
작동하는 것은 먼저 디버그 서명 버전의 앱을 생성 한 다음 릴리스 버전을 다시 생성하는 것이 었습니다.
정확히 무엇이 바뀌 었는지 또는 원래 문제가 무엇인지 알지 못했지만 효과가있었습니다. 이 오류가 상당히 성가 시므로 도움이되기를 바랍니다.
프로젝트를 청소해도 도움이되지는 않았지만 모든 모듈에서 자동 생성 된 모든 빌드 폴더를 수동으로 삭제하는 것이 도움이되었습니다.
Android Studio 3.4로 업데이트 하시겠습니까? 나는 메시지를 받는다
원인 : buildOutput.apkData가 널이 아니어야합니다.
답을 찾고 절차를 찾았습니다.
Build
-> Clean Project
but it doesn´t worked, i know that this procedure will delete the content into the /build
directory but for my experience it doesn´t work in all cases, so i tried the "raw" way, deleting the directory:
/app/build/
then i rebuild the project and it worked.
I've tried many things to solve the issue, but nothing helped. I get this error when trying to generate a signed apk.
Downgrading to older versions of Android Studio helped (3.4.2) worked, however this is not the solution.
The 'Clean Project' function in AS does not clean the place where your generated apk is created and there is one file that may be blocking the whole procedure: output.json
Try removing output.json from .../app/projectname/release/output.json
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.
It works for me:
delete build folder from your project manually.
in terminal of android studio type this command
if windows user
gradlew clean build
if linux user
./gradlew clean build
All the solutions didn't work with me
Android Studio V 3.5
Android gradle plugin V 3.4.2
Gradle Version V 5.1.1
- Clean the project
- Restart Android Studio + Invalidate Caches
- Delete the build, debug, and releases folder
- Make project
- Generate signed APK
This issue is happens usually when you are running multiple android studio window with different projects.
The solution is
- choose project than delete .gradle and build folders
- than clean and rebuild the project.
please ref screen shot attached
the only solution that works for me is using in my root gradle
classpath 'com.android.tools.build:gradle:3.3.0'
what i've tried : - clear all build folder manually - invalidate cache but none of these is work
PS: i'm using android studio 3.5 btw
Update :
just like @Vishrut Mavani, changing the destination folder of your release version is work
In my case build and launch project with different build configs was successful. But generating signed apk throws error Cause: buildOutput.apkData must not be null
on the other hand apk was generated and Build Output toggle view prints BUILD SUCCESSFUL
. Manual installation ends with message App not installed
. My fault was using compileSdkVersion 'android-P'
and after changing to compileSdkVersion 28
all goes well.
I've tried all solutions and non of them helped! finally after many trying, I figured it out, just follow the tips:
- copy your signature keystrok (that you use to release) inside
yourProject/app/
- gradle.properties (modify values related to your own key):
MYAPP_RELEASE_STORE_FILE=KEYSTROK_NAME MYAPP_RELEASE_KEY_ALIAS=KEY_ALIAS MYAPP_RELEASE_STORE_PASSWORD=R_PASS MYAPP_RELEASE_KEY_PASSWORD=K_PASS android.enableR8=true
app level build.gradle (inside android):
signingConfigs{ release{ if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) { storeFile file(MYAPP_RELEASE_STORE_FILE) storePassword MYAPP_RELEASE_STORE_PASSWORD keyAlias MYAPP_RELEASE_KEY_ALIAS keyPassword MYAPP_RELEASE_KEY_PASSWORD } } } configurations { cleanedAnnotations compile.exclude group: 'org.jetbrains' , module:'annotations' }
- app level build.gradle (inside buildTypes):
release { manifestPlaceholders = [analytics_deactivated: "false"] minifyEnabled true signingConfig signingConfigs.release useProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }
5. finally this command:
mac: ./gradlew clean assemble_YOUR_FAVOR_Release
win: gradlew clean assemble_YOUR_FAVOR_Release
where _YOUR_FAVOR_
is your optional favor, if you are not using any favor, just simply use assembleRelease
instead of assemble_YOUR_FAVOR_Release
The solution for me was to delete all files and folders from the apk output folder. I had this problem when creating a signed apk for a "production" flavor and the output.json
in the "feature" output folder causes the problem -> Android Studio 3.6 Canary 7
showed me the correct error message. It is also working now for AS 3.5 stable with Gradle Plugin 3.5.0.
All the solutions didn't work with me
In my case from AndroidStudio 3.4+ update to 3.5.
And finally I solve it by modify 'Destination Folder' to "app/build/outputs/apk"
detail pic
I was also annoyed by the same bug. But changing my Signed apk destination from c/users/project/app to c/users/project worked for me.
I have rolled back to
classpath 'com.android.tools.build:gradle:3.4.1'
And every thing works well.
Seems cleaning the project may resolve the issue, but for me it worked like this.
File->sync project with gradle files.
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
참고 URL : https://stackoverflow.com/questions/54503325/cause-buildoutput-apkdata-must-not-be-null
'IT' 카테고리의 다른 글
NoSuchMethodError를 어떻게 해결합니까? (0) | 2020.06.03 |
---|---|
Django 템플릿에서 배열 요소에 액세스하는 방법은 무엇입니까? (0) | 2020.06.03 |
하단 점이있는 Android ViewPager (0) | 2020.06.03 |
SQL Server Management Studio로 복합 키를 만들려면 어떻게해야합니까? (0) | 2020.06.03 |
z-index가 작동하지 않는 이유는 무엇입니까? (0) | 2020.06.03 |