I have an app that uses Firebase notifications and needs to be able to send and receive notifications from B4A the way it did until Google changed their authentication method. I have followed Erel's example and it works fine to be able to send from B4J. I have attempted to use the same code and resources in B4A and I have run into a number of issues. If I add #AdditionalJar: guava-23.0.jar the project will not compile (error is below). If I comment it out, it will compile. The project attributes are
<code>
#Region Project Attributes
#ApplicationLabel:B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#BridgeLogger:True
#MultiDex: true
#AdditionalJar: google-auth-library-oauth2-http-1.18.0.jar
#AdditionalJar: google-auth-library-credentials-1.18.0.jar
#AdditionalJar: guava-23.0.jar
#AdditionalJar: google-http-client-1.43.3.jar
#AdditionalJar: google-http-client-gson-1.43.3.jar
#AdditionalJar: gson-2.10.1.jar
#AdditionalJar: opencensus-api-0.31.1.jar
#AdditionalJar: opencensus-contrib-http-util-0.31.1.jar
#AdditionalJar: grpc-context-1.27.2.jar
#AdditionalJar: com.google.android.gmslay-services-vision
</code>
<Code>
B4A Version: 13.00
Parsing code. (0.04s)
Java Version: 19
Building folders structure. (0.10s)
Running custom action. (0.06s)
Compiling code. (0.11s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.10s)
(AndroidX SDK)
Compiling resources (0.11s)
Linking resources (0.54s)
build tools: 34.0.0, android jar: android-34
Compiling debugger engine code. (0.01s)
Compiling generated Java code. (0.17s)
Finding libraries that need to be dexed. (0.04s)
Dex code (2.39s)
Dex merge Error
Error in C:\Android\tools\..\extras\b4a_local\unpacked-guava-23.0-63864375760027\dex_v1\guava-23.0.zip:classes.dex:
Type com.google.common.util.concurrent.ListenableFuture is defined multiple times: C:\Android\tools\..\extras\b4a_local\unpacked-guava-23.0-63864375760027\dex_v1\guava-23.0.zip:classes.dex, C:\Android\tools\..\extras\b4a_local\unpacked-com.google.guava-listenablefuture-63860276976000\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-guava-23.0-63864375760027\dex_v1\guava-23.0.zip:classes.dex
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:1269)
at com.android.tools.r8.D8.main(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:5)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Android\tools\..\extras\b4a_local\unpacked-guava-23.0-63864375760027\dex_v1\guava-23.0.zip:classes.dex
at Version.fakeStackEntry(Version_8.3.37.java:0)
at com.android.tools.r8.Q.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:5)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:244)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:90)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:909)
at com.android.tools.r8.internal.po.b(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:99)
at com.android.tools.r8.D8.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:1041)
at com.android.tools.r8.D8.b(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:514)
at com.android.tools.r8.D8.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:1076)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:1256)
... 1 more
Caused by: com.android.tools.r8.internal.h: Type com.google.common.util.concurrent.ListenableFuture is defined multiple times: C:\Android\tools\..\extras\b4a_local\unpacked-guava-23.0-63864375760027\dex_v1\guava-23.0.zip:classes.dex, C:\Android\tools\..\extras\b4a_local\unpacked-com.google.guava-listenablefuture-63860276976000\dex_v1\com.google.guava-listenablefuture.zip:classes.dex
at com.android.tools.r8.internal.X30.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:346)
at com.android.tools.r8.internal.pX.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:232)
at com.android.tools.r8.internal.pX.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:91)
at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
at com.android.tools.r8.internal.pX.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:32)
at com.android.tools.r8.graph.q4$a.d(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:6)
at com.android.tools.r8.dex.c.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:264)
</Code>
The libraries I am using are
B4XPages 1.12
Core 12.8
Firebase Analytics 3.01
Firebase Notifications 3.11
JSON 1.21
OkHTTP 1.50
OKHTTPUtils2 3.04
Phone 2.60
Runtime Permissions 1.2
Manifest is
<Code>
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="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, FirebaseAnalytics.FirebaseAnalytics)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
</Code>
SDK Manager is up to date but I get an error "Error reading recommended items list". I don't think this is related because I was having the issue prior to seeing this.
Hopefully this is enough information and ideas are appreciated.
<code>
#Region Project Attributes
#ApplicationLabel:B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#BridgeLogger:True
#MultiDex: true
#AdditionalJar: google-auth-library-oauth2-http-1.18.0.jar
#AdditionalJar: google-auth-library-credentials-1.18.0.jar
#AdditionalJar: guava-23.0.jar
#AdditionalJar: google-http-client-1.43.3.jar
#AdditionalJar: google-http-client-gson-1.43.3.jar
#AdditionalJar: gson-2.10.1.jar
#AdditionalJar: opencensus-api-0.31.1.jar
#AdditionalJar: opencensus-contrib-http-util-0.31.1.jar
#AdditionalJar: grpc-context-1.27.2.jar
#AdditionalJar: com.google.android.gmslay-services-vision
</code>
<Code>
B4A Version: 13.00
Parsing code. (0.04s)
Java Version: 19
Building folders structure. (0.10s)
Running custom action. (0.06s)
Compiling code. (0.11s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.10s)
(AndroidX SDK)
Compiling resources (0.11s)
Linking resources (0.54s)
build tools: 34.0.0, android jar: android-34
Compiling debugger engine code. (0.01s)
Compiling generated Java code. (0.17s)
Finding libraries that need to be dexed. (0.04s)
Dex code (2.39s)
Dex merge Error
Error in C:\Android\tools\..\extras\b4a_local\unpacked-guava-23.0-63864375760027\dex_v1\guava-23.0.zip:classes.dex:
Type com.google.common.util.concurrent.ListenableFuture is defined multiple times: C:\Android\tools\..\extras\b4a_local\unpacked-guava-23.0-63864375760027\dex_v1\guava-23.0.zip:classes.dex, C:\Android\tools\..\extras\b4a_local\unpacked-com.google.guava-listenablefuture-63860276976000\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-guava-23.0-63864375760027\dex_v1\guava-23.0.zip:classes.dex
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:1269)
at com.android.tools.r8.D8.main(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:5)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Android\tools\..\extras\b4a_local\unpacked-guava-23.0-63864375760027\dex_v1\guava-23.0.zip:classes.dex
at Version.fakeStackEntry(Version_8.3.37.java:0)
at com.android.tools.r8.Q.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:5)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:244)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:90)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:909)
at com.android.tools.r8.internal.po.b(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:99)
at com.android.tools.r8.D8.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:1041)
at com.android.tools.r8.D8.b(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:514)
at com.android.tools.r8.D8.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:1076)
at com.android.tools.r8.internal.po.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:1256)
... 1 more
Caused by: com.android.tools.r8.internal.h: Type com.google.common.util.concurrent.ListenableFuture is defined multiple times: C:\Android\tools\..\extras\b4a_local\unpacked-guava-23.0-63864375760027\dex_v1\guava-23.0.zip:classes.dex, C:\Android\tools\..\extras\b4a_local\unpacked-com.google.guava-listenablefuture-63860276976000\dex_v1\com.google.guava-listenablefuture.zip:classes.dex
at com.android.tools.r8.internal.X30.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:346)
at com.android.tools.r8.internal.pX.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:232)
at com.android.tools.r8.internal.pX.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:91)
at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
at com.android.tools.r8.internal.pX.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:32)
at com.android.tools.r8.graph.q4$a.d(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:6)
at com.android.tools.r8.dex.c.a(R8_8.3.37_d0b8d9dfe8720e37c27d2233931d9d72dbd696ffd92111cc9b36e58b4baad1cc:264)
</Code>
The libraries I am using are
B4XPages 1.12
Core 12.8
Firebase Analytics 3.01
Firebase Notifications 3.11
JSON 1.21
OkHTTP 1.50
OKHTTPUtils2 3.04
Phone 2.60
Runtime Permissions 1.2
Manifest is
<Code>
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="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, FirebaseAnalytics.FirebaseAnalytics)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
</Code>
SDK Manager is up to date but I get an error "Error reading recommended items list". I don't think this is related because I was having the issue prior to seeing this.
Hopefully this is enough information and ideas are appreciated.