Android Question Problem when use FirebaseAuth

Juanet

Member
Licensed User
Longtime User
Hi, i have a problem when try to use FirebaseAuth, these are the steps and errors:

1) Installed and using B4A Version 12.20 (64 bit)

2) Unpacked "commandlinetools-win-9123335_latest.zip" in "C:\Android"

3) Unpacked "resources_11_22.zip" in "C:\Android"

4) Using the project "FirebaseAuth" posted in : https://www.b4x.com/android/forum/threads/firebaseauth-authenticate-your-users.67875/

5) Followed the rules posted in: https://www.b4x.com/android/forum/threads/integrating-firebase-services.67692/

6) Added the "google-services.json" file to the B4A Project folder

Thats the project manifest file:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="31"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:hardwareAccelerated, "true")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.

CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseAuth.FirebaseAuth)
CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)

When build everything is fine, but when signin i have that's error:

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
onAuthStateChanged: com.google.firebase.auth.internal.zzv@c908b0b
SignInWithGoogle called
** Activity (main) Pause, UserClosed = false **
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/arch/core/executor/ArchTaskExecutor;
    at androidx.lifecycle.LifecycleRegistry.enforceMainThreadIfNeeded(LifecycleRegistry.java:322)
    at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:178)
    at androidx.activity.ComponentActivity.<init>(ComponentActivity.java:277)
    at androidx.fragment.app.FragmentActivity.<init>(FragmentActivity.java:108)
    at com.google.android.gms.auth.api.signin.internal.SignInHubActivity.<init>(com.google.android.gms:play-services-auth@@20.3.0:1)
    at java.lang.Class.newInstance(Native Method)
    at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
    at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1256)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3406)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3677)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2132)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:236)
    at android.app.ActivityThread.main(ActivityThread.java:7843)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
Caused by: java.lang.ClassNotFoundException: androidx.arch.core.executor.ArchTaskExecutor
    ... 21 more

On the other hand, in a new B4XPages project, when try to build with exactly the same configuration in the manifest file, i have this error:

B4X:
Dex merge    Error
Error in C:\Android\tools\..\extras\b4a_local\unpacked-pnd-guava-31.1-android-63805534196160\dex_v1\pnd-guava-31.1-android.zip:classes.dex:
Type com.google.common.util.concurrent.ListenableFuture is defined multiple times: C:\Android\tools\..\extras\b4a_local\unpacked-pnd-guava-31.1-android-63805534196160\dex_v1\pnd-guava-31.1-android.zip:classes.dex, C:\Android\tools\..\extras\b4a_local\unpacked-com.google.guava-listenablefuture-63810086728000\dex_v1\com.google.guava-listenablefuture.zip:classes.dex
Compilation failed
Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Android\tools\..\extras\b4a_local\unpacked-pnd-guava-31.1-android-63805534196160\dex_v1\pnd-guava-31.1-android.zip:classes.dex
    at com.android.tools.r8.internal.vj.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:98)
    at com.android.tools.r8.D8.main(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:4)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Android\tools\..\extras\b4a_local\unpacked-pnd-guava-31.1-android-63805534196160\dex_v1\pnd-guava-31.1-android.zip:classes.dex
    at Version.fakeStackEntry(Version_3.3.20-dev+aosp1.java:0)
    at com.android.tools.r8.internal.vj.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:75)
    at com.android.tools.r8.internal.vj.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:28)
    at com.android.tools.r8.internal.vj.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:27)
    at com.android.tools.r8.internal.vj.b(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:2)
    at com.android.tools.r8.D8.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:22)
    at com.android.tools.r8.D8.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:17)
    at com.android.tools.r8.internal.vj.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:85)
    ... 1 more
Caused by: com.android.tools.r8.internal.f: Type com.google.common.util.concurrent.ListenableFuture is defined multiple times: C:\Android\tools\..\extras\b4a_local\unpacked-pnd-guava-31.1-android-63805534196160\dex_v1\pnd-guava-31.1-android.zip:classes.dex, C:\Android\tools\..\extras\b4a_local\unpacked-com.google.guava-listenablefuture-63810086728000\dex_v1\com.google.guava-listenablefuture.zip:classes.dex
    at com.android.tools.r8.internal.YS.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:14)
    at com.android.tools.r8.internal.YS.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:22)
    at com.android.tools.r8.internal.cN.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:36)
    at com.android.tools.r8.internal.cN.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:10)
    at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
    at com.android.tools.r8.internal.cN.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:6)
    at com.android.tools.r8.graph.E2$a.e(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:4)
    at com.android.tools.r8.dex.b.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:105)
    at com.android.tools.r8.dex.b.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:28)
    at com.android.tools.r8.D8.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:25)
    at com.android.tools.r8.D8.d(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:609)
    at com.android.tools.r8.D8.c(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:1)
    at com.android.tools.r8.internal.vj.a(R8_3.3.20-dev+aosp1_dd4c01853fd917497aef2d09abff533f0d25b062517ea74449d40e1778a34753:24)
    ... 5 more


I have no idea why this happens, if someone can help me I would appreciate it, thank you very much.
 

Juanet

Member
Licensed User
Longtime User
Finally I have created a new project in B4XPages with FirebaseAuth, the problem with errors came from the PndExoPlayer library that in the end I have replaced with ExoPlayer and everything works normally.

B4XPages error when use PndExoPlayer:
B4X:
Error in C:\Android\tools\..\extras\b4a_local\unpacked-pnd-guava-31.1-android-63805534196160\dex_v1\pnd-guava-31.1-android.zip:classes.dex: ....

No errors if not use FirebaseAuth when use PndExoPlayer :oops:
No errors if use FirebaseAuth when use ExoPlayer :)

Conclusion, use ExoPlayer if you use FirebaseAuth.

I just wanted to put it on the record in case someone else happens.
 
Upvote 0
Top