Android

[Firestore Database]java.lang.RuntimeException: Internal error in Cloud Firestore (24.0.1). 오류 해결방법 ( Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: c.a.Ea.values [])

앱에 새로운 기능을 추가 후 릴리즈 버전으로 apk를 생성 후 마켓에 등록하기 전에 휴대폰에 복사 후 설치하였다

새로운 기능은 구글파이베이스의 클라우드 파이어스토어를 사용하여 개발하였다.

그런데 예상과 다르게 클라우드 파이어스토어 내부 오류가 발생하였다.

오류 내용은 다음과 같다.

 Process: com.test, PID: 14469
    java.lang.RuntimeException: Internal error in Cloud Firestore (24.0.1).
        at com.google.firebase.firestore.i.u.a(Unknown Source:19)
        at com.google.firebase.firestore.i.e.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7615)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
     Caused by: b.b.a.b.i.g: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
        at b.b.a.b.i.I.b(:3)
        at com.google.firebase.firestore.h.N.a(Unknown Source:0)
        at com.google.firebase.firestore.h.j.a(Unknown Source:6)
        at b.b.a.b.i.v.run(Unknown Source:21)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at com.google.firebase.firestore.i.r.run(Unknown Source:15)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
        at b.b.a.b.i.J.run(Unknown Source:17)
        at com.google.firebase.firestore.i.H.a(Unknown Source:0)
        at com.google.firebase.firestore.i.h.run(Unknown Source:4)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919) 
     Caused by: java.lang.ExceptionInInitializerError
        at c.a.c.o.forTarget(Unknown Source:0)
        at c.a.Na.forTarget(:4)
        at com.google.firebase.firestore.h.O.a(:1)
        at com.google.firebase.firestore.h.k.call(Unknown Source:2)
        at b.b.a.b.i.J.run(Unknown Source:4)
        at com.google.firebase.firestore.i.H.a(Unknown Source:0) 
        at com.google.firebase.firestore.i.h.run(Unknown Source:4) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 
     Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: c.a.Pb.values []
        at java.lang.Enum.enumValues(Enum.java:270)
        at java.lang.Enum.access$000(Enum.java:61)
        at java.lang.Enum$1.create(Enum.java:277)
        at java.lang.Enum$1.create(Enum.java:275)
        at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
        at java.lang.Enum.getSharedConstants(Enum.java:289)
        at java.lang.Class.getEnumConstantsShared(Class.java:2428)
        at java.util.EnumSet.getUniverse(EnumSet.java:407)
        at java.util.EnumSet.noneOf(EnumSet.java:109)
        at java.util.EnumSet.of(EnumSet.java:235)
        at c.a.c.o.<clinit>(Unknown Source:102)
        at c.a.c.o.forTarget(Unknown Source:0) 
        at c.a.Na.forTarget(:4) 
        at com.google.firebase.firestore.h.O.a(:1) 
        at com.google.firebase.firestore.h.k.call(Unknown Source:2) 
        at b.b.a.b.i.J.run(Unknown Source:4) 
        at com.google.firebase.firestore.i.H.a(Unknown Source:0) 
        at com.google.firebase.firestore.i.h.run(Unknown Source:4) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 
     Caused by: java.lang.NoSuchMethodException: c.a.Pb.values []
        at java.lang.Class.getMethod(Class.java:2072)
        at java.lang.Class.getDeclaredMethod(Class.java:2050)
        at java.lang.Enum.enumValues(Enum.java:267)
        at java.lang.Enum.access$000(Enum.java:61) 
        at java.lang.Enum$1.create(Enum.java:277) 
        at java.lang.Enum$1.create(Enum.java:275) 
        at libcore.util.BasicLruCache.get(BasicLruCache.java:63) 
        at java.lang.Enum.getSharedConstants(Enum.java:289) 
        at java.lang.Class.getEnumConstantsShared(Class.java:2428) 
        at java.util.EnumSet.getUniverse(EnumSet.java:407) 
        at java.util.EnumSet.noneOf(EnumSet.java:109) 
        at java.util.EnumSet.of(EnumSet.java:235) 
        at c.a.c.o.<clinit>(Unknown Source:102) 
        at c.a.c.o.forTarget(Unknown Source:0) 
        at c.a.Na.forTarget(:4) 
        at com.google.firebase.firestore.h.O.a(:1) 
        at com.google.firebase.firestore.h.k.call(Unknown Source:2) 
        at b.b.a.b.i.J.run(Unknown Source:4) 
        at com.google.firebase.firestore.i.H.a(Unknown Source:0) 
        at com.google.firebase.firestore.i.h.run(Unknown Source:4) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 
2022-02-12 17:22:19.344 14469-14469/? E/UncaughtException: java.lang.RuntimeException: Internal error in Cloud Firestore (24.0.1).
        at com.google.firebase.firestore.i.u.a(Unknown Source:19)
        at com.google.firebase.firestore.i.e.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7615)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
     Caused by: b.b.a.b.i.g: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
        at b.b.a.b.i.I.b(:3)
        at com.google.firebase.firestore.h.N.a(Unknown Source:0)
        at com.google.firebase.firestore.h.j.a(Unknown Source:6)
        at b.b.a.b.i.v.run(Unknown Source:21)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at com.google.firebase.firestore.i.r.run(Unknown Source:15)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
        at b.b.a.b.i.J.run(Unknown Source:17)
        at com.google.firebase.firestore.i.H.a(Unknown Source:0)
        at com.google.firebase.firestore.i.h.run(Unknown Source:4)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919) 
     Caused by: java.lang.ExceptionInInitializerError
        at c.a.c.o.forTarget(Unknown Source:0)
        at c.a.Na.forTarget(:4)
        at com.google.firebase.firestore.h.O.a(:1)
        at com.google.firebase.firestore.h.k.call(Unknown Source:2)
        at b.b.a.b.i.J.run(Unknown Source:4)
        at com.google.firebase.firestore.i.H.a(Unknown Source:0) 
        at com.google.firebase.firestore.i.h.run(Unknown Source:4) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 
     Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: c.a.Pb.values []
        at java.lang.Enum.enumValues(Enum.java:270)
        at java.lang.Enum.access$000(Enum.java:61)
        at java.lang.Enum$1.create(Enum.java:277)
        at java.lang.Enum$1.create(Enum.java:275)
        at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
        at java.lang.Enum.getSharedConstants(Enum.java:289)
        at java.lang.Class.getEnumConstantsShared(Class.java:2428)
        at java.util.EnumSet.getUniverse(EnumSet.java:407)
        at java.util.EnumSet.noneOf(EnumSet.java:109)
        at java.util.EnumSet.of(EnumSet.java:235)
        at c.a.c.o.<clinit>(Unknown Source:102)
        at c.a.c.o.forTarget(Unknown Source:0) 
        at c.a.Na.forTarget(:4) 
        at com.google.firebase.firestore.h.O.a(:1) 
        at com.google.firebase.firestore.h.k.call(Unknown Source:2) 
        at b.b.a.b.i.J.run(Unknown Source:4) 
        at com.google.firebase.firestore.i.H.a(Unknown Source:0) 
        at com.google.firebase.firestore.i.h.run(Unknown Source:4) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 
     Caused by: java.lang.NoSuchMethodException: c.a.Pb.values []
        at java.lang.Class.getMethod(Class.java:2072)
        at java.lang.Class.getDeclaredMethod(Class.java:2050)
        at java.lang.Enum.enumValues(Enum.java:267)
        at java.lang.Enum.access$000(Enum.java:61) 
        at java.lang.Enum$1.create(Enum.java:277) 
        at java.lang.Enum$1.create(Enum.java:275) 
        at libcore.util.BasicLruCache.get(BasicLruCache.java:63) 
        at java.lang.Enum.getSharedConstants(Enum.java:289) 
        at java.lang.Class.getEnumConstantsShared(Class.java:2428) 
        at java.util.EnumSet.getUniverse(EnumSet.java:407) 
        at java.util.EnumSet.noneOf(EnumSet.java:109) 
        at java.util.EnumSet.of(EnumSet.java:235) 
        at c.a.c.o.<clinit>(Unknown Source:102) 
        at c.a.c.o.forTarget(Unknown Source:0) 
        at c.a.Na.forTarget(:4) 
        at com.google.firebase.firestore.h.O.a(:1) 
        at com.google.firebase.firestore.h.k.call(Unknown Source:2) 
        at b.b.a.b.i.J.run(Unknown Source:4) 
        at com.google.firebase.firestore.i.H.a(Unknown Source:0) 
        at com.google.firebase.firestore.i.h.run(Unknown Source:4) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 
2022-02-12 17:22:19.571 14469-14469/? E/UncaughtException: Ouch! My own exception handler threw an exception.
    java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: c.a.c.o
        at java.util.concurrent.FutureTask.report(FutureTask.java:123)
        at java.util.concurrent.FutureTask.get(FutureTask.java:207)
        at com.google.firebase.crash.c.uncaughtException(Unknown Source:32)
        at org.chromium.base.JavaExceptionReporter.uncaughtException(chromium-TrichromeWebViewGoogle.aab-stable-475808733:6)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1073)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
        at java.lang.Thread.dispatchUncaughtException(Thread.java:2187)
     Caused by: java.lang.NoClassDefFoundError: c.a.c.o
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:454)
        at java.lang.Class.forName(Class.java:379)
        at aqj.f(:com.google.android.gms.dynamite_dynamitemodulesc@214815065@21.48.15 (100400-0):32)
        at aqj.f(:com.google.android.gms.dynamite_dynamitemodulesc@214815065@21.48.15 (100400-0):42)
        at aqj.f(:com.google.android.gms.dynamite_dynamitemodulesc@214815065@21.48.15 (100400-0):42)
        at aqj.f(:com.google.android.gms.dynamite_dynamitemodulesc@214815065@21.48.15 (100400-0):42)
        at aqj.a(:com.google.android.gms.dynamite_dynamitemodulesc@214815065@21.48.15 (100400-0):12)
        at com.google.firebase.crash.internal.api.FirebaseCrashApiImpl.b(:com.google.android.gms.dynamite_dynamitemodulesc@214815065@21.48.15 (100400-0):7)
        at com.google.firebase.crash.internal.api.FirebaseCrashApiImpl.reportUncaughtException(:com.google.android.gms.dynamite_dynamitemodulesc@214815065@21.48.15 (100400-0):2)
        at apx.a(:com.google.android.gms.dynamite_dynamitemodulesc@214815065@21.48.15 (100400-0):9)
        at mv.onTransact(:com.google.android.gms.dynamite_dynamitemodulesc@214815065@21.48.15 (100400-0):4)
        at android.os.Binder.transact(Binder.java:939)
        at com.google.android.gms.internal.crash.a.b(Unknown Source:7)
        at com.google.android.gms.internal.crash.e.a(:1)
        at com.google.android.gms.internal.crash.c.run(:2)
        at com.google.android.gms.internal.crash.e.run(Unknown Source:0)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: java.lang.ExceptionInInitializerError
        at c.a.c.o.forTarget(Unknown Source:0)
        at c.a.Na.forTarget(:4)
        at com.google.firebase.firestore.h.O.a(:1)
        at com.google.firebase.firestore.h.k.call(Unknown Source:2)
        at b.b.a.b.i.J.run(Unknown Source:4)
        at com.google.firebase.firestore.i.H.a(Unknown Source:0)
        at com.google.firebase.firestore.i.h.run(Unknown Source:4)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 
     Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: c.a.Pb.values []
        at java.lang.Enum.enumValues(Enum.java:270)
        at java.lang.Enum.access$000(Enum.java:61)
        at java.lang.Enum$1.create(Enum.java:277)
        at java.lang.Enum$1.create(Enum.java:275)
        at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
        at java.lang.Enum.getSharedConstants(Enum.java:289)
        at java.lang.Class.getEnumConstantsShared(Class.java:2428)
        at java.util.EnumSet.getUniverse(EnumSet.java:407)
        at java.util.EnumSet.noneOf(EnumSet.java:109)
        at java.util.EnumSet.of(EnumSet.java:235)
        at c.a.c.o.<clinit>(Unknown Source:102)
        at c.a.c.o.forTarget(Unknown Source:0) 
        at c.a.Na.forTarget(:4) 
        at com.google.firebase.firestore.h.O.a(:1) 
        at com.google.firebase.firestore.h.k.call(Unknown Source:2) 
        at b.b.a.b.i.J.run(Unknown Source:4) 
        at com.google.firebase.firestore.i.H.a(Unknown Source:0) 
        at com.google.firebase.firestore.i.h.run(Unknown Source:4) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 
     Caused by: java.lang.NoSuchMethodException: c.a.Pb.values []
        at java.lang.Class.getMethod(Class.java:2072)
        at java.lang.Class.getDeclaredMethod(Class.java:2050)
        at java.lang.Enum.enumValues(Enum.java:267)
        at java.lang.Enum.access$000(Enum.java:61) 
        at java.lang.Enum$1.create(Enum.java:277) 
        at java.lang.Enum$1.create(Enum.java:275) 
        at libcore.util.BasicLruCache.get(BasicLruCache.java:63) 
        at java.lang.Enum.getSharedConstants(Enum.java:289) 
        at java.lang.Class.getEnumConstantsShared(Class.java:2428) 
        at java.util.EnumSet.getUniverse(EnumSet.java:407) 
        at java.util.EnumSet.noneOf(EnumSet.java:109) 
        at java.util.EnumSet.of(EnumSet.java:235) 
        at c.a.c.o.<clinit>(Unknown Source:102) 
        at c.a.c.o.forTarget(Unknown Source:0) 
        at c.a.Na.forTarget(:4) 
        at com.google.firebase.firestore.h.O.a(:1) 
        at com.google.firebase.firestore.h.k.call(Unknown Source:2) 
        at b.b.a.b.i.J.run(Unknown Source:4) 
        at com.google.firebase.firestore.i.H.a(Unknown Source:0) 
        at com.google.firebase.firestore.i.h.run(Unknown Source:4) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919)

이런 오류는 코드난독화가 원인인 경우가 있다. 코드난독화를 해제하고 시도해보았다.

역시나 그랬다.. 코드 난독화로 오류가 발생하였다.

그런데 가이드 문서를 보니 ProGuard 사용을 권장(?)하고 있다. 

오류는 어쩌고?


 


선택사항: ProGuard 구성

앱에서 ProGuard와 함께 Firebase 실시간 데이터베이스를 사용하는 경우 난독화 후에 모델 객체가 직렬화 및 역직렬화되는 방법을 고려해야 합니다. DataSnapshot.getValue(Class) 또는 DatabaseReference.setValue(Object)를 사용하여 데이터를 읽고 쓰는 경우 proguard-rules.pro 파일에 다음과 같이 규칙을 추가해야 합니다.

    # Add this global rule
    -keepattributes Signature

    # This rule will properly ProGuard all the model classes in
    # the package com.yourcompany.models.
    # Modify this rule to fit the structure of your app.
    -keepclassmembers class com.yourcompany.models.** {
      *;
    }

 

오류원인은 파이스토어 데이터베이스와는 아무런 관련이 없다.

근본적인 문제는 java.lang.EnumSet이 proguard에 의해 제거되고 있다는 것이다.

 

이번에 앱을 업데이트하면서 자바 버전을  1.8로 올렸다.

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

 

 

나와 동일한 오류로 고통받고 있는 개발자들도 있다.

https://github.com/firebase/firebase-android-sdk/issues/1562

 

io.opencensus.trace + proguard causing a crash · Issue #1562 · firebase/firebase-android-sdk

Android Studio version: 3.6.1 Firebase Component: Firestore (Database, Firestore, Storage, Functions, etc) Component version: 21.4.3 [REQUIRED] Step 3: Describe the problem java.lang.RuntimeExcepti…

github.com

 

 

오류 해결을 위해 proguard-rules.pro에 enum 관련 다음 규칙을 추가하여 문제를 해결하였다.

-keepclassmembers enum * {
     **[] $VALUES;
        public *;
}

[REFERENCE]

 

[연관 자료들]

 

 

Leave a Reply

error: Content is protected !!