Debug에서는 잘 작동하지만 Release로 실행할 경우에 에러가 발생했다.
원인
Release 버전으로 생성할 경우 Proguard가 미사용 코드를 삭제함
정확하진 않아 필요한 클래스도 삭제될 수 있음
해결
...
@IgnoreExtraProperties
@Keep
public class Posto {
public String uid;
public String nome;
...
제거되지 않도록 해당 클래스에 annotation을 붙임
build.gradle : app으로 이동하여
implementation 'com.android.support:support-annotations:28.0.0'
추가
Firebase realtime database does not retrieving data in release apk [Android]
The data retrieved perfectly when run the app on the device or emulator, but it is not showing the images when generate release apk I think the problem is due to proguard so I tried this answer h...
stackoverflow.com
https://developer.android.com/studio/build/shrink-code.html#keep-code
앱 축소, 난독화 및 최적화 | Android 개발자 | Android Developers
사용하지 않는 코드와 리소스를 삭제하기 위해 출시 빌드에서 코드를 축소하는 방법을 알아보세요.
developer.android.com
'안드로이드' 카테고리의 다른 글
[안드로이드] Debug / Release SHA-1 추출하기 (0) | 2021.04.24 |
---|---|
[안드로이드] 화면 사이즈 구하기 (0) | 2021.04.12 |
[안드로이드] 자동 백업 막기 (0) | 2021.03.18 |
[안드로이드] Error inflating class com.google.android.material.card.MaterialCardView 해결 (0) | 2021.03.15 |
안드로이드 Error msg : java.lang.IllegalStateException: commit already called (0) | 2021.01.11 |