Android Question Duplicate class in 2 referenced libraries (FirebaseNotification and SQLCipher)

tucano2000

Active Member
Licensed User
Longtime User
I'm trying to include Firebase to use the push notification feature.

When I add the FirebaseNotifications library to B4A IDE and compile, the following error appears:

B4A version: 6.80
Parsing code. (0.00s)
Compiling code. (0.11s)

ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Generating R file. (1.17s)
Compiling generated Java code. (1.66s)
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/common/base/FinalizableReference;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:615)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:570)
at com.android.dx.command.dexer.Main.access$2(Main.java:546)
at com.android.dx.command.dexer.Main$2.processFileBytes(Main.java:514)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:537)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:449)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:236)
at com.android.dx.command.dexer.Main.run(Main.java:206)
at com.android.dx.command.dexer.Main.main(Main.java:179)
at com.android.dx.command.Main.main(Main.java:103)
1 error; aborting


I researched the problem and found it to be caused by duplicate classes. I also discovered that the other library that is in conflict is the SQLCipher. By referencing this library together with the FirebaseNotification library you can simulate the error.

I tried opening .jar file with 7zip to delete the duplicate class but I did not find it and the .class file appears scrambled in the text editor.

How do I solve this? I need the 2 libraries in my application. Is it possible to resolve using #ExcludeClasses?
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Can you post a small example project which shows the problem?

Edit: you noticed this comment?

B4X:
SQLCipher v1.20 is now available. The previous version crashes on Android 4.4.

Starting from v1.20 the native libraries are included in the jar file. This means that you should delete sqlcipher_native.zip from the files tab. However you should add instead a file named icudt46l.zip.

The last parameter in the Initialize method is not used anymore.

Not sure if this is the issue here... But worth a try i guess
 
Upvote 0

tucano2000

Active Member
Licensed User
Longtime User
I am using SQLCIpher V1.30. It is based on SQLCipher v3.3.1 because older versions are not compatible with Android 6. FirebaseNotifications library V1.10.

https://www.b4x.com/android/forum/threads/android-database-encryption-with-sqlcipher-library.14965/

Link to download library SQLCipher v1.30 => https://www.b4x.com/android/files/SQLCipher330.zip

Link to download library FirebaseNotifications v1.10 => https://www.b4x.com/android/forum/attachments/firebasenotifications-zip.52228/

Project link to download: http://www.infranote.net/b4x_forum/FIrebase_Push_Notification_Test.zip

To test the issue, simply create an empty project by marking the libraries:

AWpvCq7.png
 
Last edited:
Upvote 0

tucano2000

Active Member
Licensed User
Longtime User
Excellent !!! Works !!! Thank you Erel.

I was using the SDK Manager to update the SDK. But the latest available version of Google Repository showed 53.

I used the B4A SDK Manager tool and it was showing version 54. After downloading the new version, I just replace the m2repository folder located in android-sdk \ extras \ google.

As I had previously compiled the project with the old m2respository folder, I needed to use the Tools / Clean Project function in B4A IDE to success in compiling.

Therefore, SDK Manager was not showing the latest version properly since I had followed all the steps to install and configure Firebase.

B4A SDK Manager is another great tool to help us !!!
 
Upvote 0
Top