Android Question Conflict in merge for keyvaluestore and sqlcipherb4a when R8optimize is true

mcqueccu

Expert
Licensed User
Longtime User
Sqlcipherb4a depends on sqlite-2.4.0.aar and when I add keyvaluestore, it seems to be pulling some AndroidX SQLite 2.5.2, hence creating a merge conflict when compiling with R8 optimization = true


Code: Copy
:null,0
java.lang.ClassNotFoundException: com$SQLCipherB4A$SQLCipher
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:591)
    at java.lang.Class.forName(Class.java:496)
    at anywheresoftware.b4a.shell.Shell.getCorrectClassName(SourceFile:28)
    at anywheresoftware.b4a.shell.Shell.createObject(SourceFile:10)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(SourceFile:491)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(SourceFile:12)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(SourceFile:264)
    at com.leafey.sqlcipher.main.afterFirstLayout(SourceFile:122)
    at com.leafey.sqlcipher.main.access$000(SourceFile:1)
    at com.leafey.sqlcipher.main$WaitForLayout.run(SourceFile:68)
    at android.os.Handler.handleCallback(Handler.java:1070)
    at android.os.Handler.dispatchMessage(Handler.java:125)
    at android.os.Looper.dispatchMessage(Looper.java:333)
    at android.os.Looper.loopOnce(Looper.java:263)
    at android.os.Looper.loop(Looper.java:367)
    at android.app.ActivityThread.main(ActivityThread.java:9287)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:566)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)
Caused by: java.lang.ClassNotFoundException: com$SQLCipherB4A$SQLCipher
    ... 21 more
:null,0
java.lang.RuntimeException: Unexpected command: 99
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(SourceFile:295)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(SourceFile:12)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(SourceFile:264)
    at com.leafey.sqlcipher.main.initializeGlobals(SourceFile:9)
    at com.leafey.sqlcipher.main.afterFirstLayout(SourceFile:135)
    at com.leafey.sqlcipher.main.access$000(SourceFile:1)
    at com.leafey.sqlcipher.main$WaitForLayout.run(SourceFile:68)
    at android.os.Handler.handleCallback(Handler.java:1070)
    at android.os.Handler.dispatchMessage(Handler.java:125)
    at android.os.Looper.dispatchMessage(Looper.java:333)
    at android.os.Looper.loopOnce(Looper.java:263)
    at android.os.Looper.loop(Looper.java:367)
    at android.app.ActivityThread.main(ActivityThread.java:9287)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:566)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)
 
Last edited:
Solution
Ok. I have narrowed it down to FIREBASEADMOB2 by removing the libraries one after the other and compiling.

Removing both these lines SOLVED it. Removing only the dependon line did not solve it

1. <dependsOn>sqlite-2.4.0.aar</dependsOn> from the end of SQLCipherB4A.xml.
2. #AdditionalJar: sqlite-2.4.0.aar

Now: All libraries are working together
Keyvaluestore, SQLCipherB4A, and FirebaseAdmob2

Thank you community
You are right. It works in Release Mode with no errors (with just the two libraries: SQLCipherB4A and Keyvaluestore Libraries)


But, when I run the main project code, which has lots of libraries, I get a compilation error even in release mode. I think there is another library which is conflicting.
Code: Copy
B4A Version: 14.20
Parsing code.    (0.24s)
    Java Version: 19
Building folders structure.    (0.11s)
Running custom action.    (0.07s)
Compiling code.    (0.31s)
Compiling layouts code.    (0.02s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Compiling resources    (0.09s)
Linking resources    (0.80s)
    build tools: 36.1.0, android jar: android-36
Compiling generated Java code.    (0.07s)
Selecting dexer based on #R8Optimizer flag.    (0.00s)
Dexing and optimizing with R8    Error
Error in c:\androidsdkflutter\tools\..\extras\b4a_local\unpacked-sqlite-2.4.0-63845074548000\jars\classes.jar:androidx/sqlite/db/SimpleSQLiteQuery$Companion.class:
Type androidx.sqlite.db.SimpleSQLiteQuery$Companion is defined multiple times: c:\androidsdkflutter\tools\..\extras\b4a_local\unpacked-sqlite-2.4.0-63845074548000\jars\classes.jar:androidx/sqlite/db/SimpleSQLiteQuery$Companion.class, c:\androidsdkflutter\tools\..\extras\b4a_remote\androidx\sqlite\sqlite-android\2.5.2\unpacked-sqlite-android-2.5.2\jars\classes.jar:androidx/sqlite/db/SimpleSQLiteQuery$Companion.class
Compilation failed
Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: c:\androidsdkflutter\tools\..\extras\b4a_local\unpacked-sqlite-2.4.0-63845074548000\jars\classes.jar:androidx/sqlite/db/SimpleSQLiteQuery$Companion.class
    at com.android.tools.r8.internal.Nu.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:131)
    at com.android.tools.r8.R8.main(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:5)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: c:\androidsdkflutter\tools\..\extras\b4a_local\unpacked-sqlite-2.4.0-63845074548000\jars\classes.jar:androidx/sqlite/db/SimpleSQLiteQuery$Companion.class
    at Version.fakeStackEntry(Version_8.9.27.java:0)
    at com.android.tools.r8.S.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:5)
    at com.android.tools.r8.internal.Nu.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:82)
    at com.android.tools.r8.internal.Nu.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:32)
    at com.android.tools.r8.internal.Nu.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:31)
    at com.android.tools.r8.R8.b(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:48)
    at com.android.tools.r8.R8.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:1589)
    at com.android.tools.r8.internal.Nu.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:118)
    ... 1 more
Caused by: com.android.tools.r8.internal.g: Type androidx.sqlite.db.SimpleSQLiteQuery$Companion is defined multiple times: c:\androidsdkflutter\tools\..\extras\b4a_local\unpacked-sqlite-2.4.0-63845074548000\jars\classes.jar:androidx/sqlite/db/SimpleSQLiteQuery$Companion.class, c:\androidsdkflutter\tools\..\extras\b4a_remote\androidx\sqlite\sqlite-android\2.5.2\unpacked-sqlite-android-2.5.2\jars\classes.jar:androidx/sqlite/db/SimpleSQLiteQuery$Companion.class
    at com.android.tools.r8.internal.Le0.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:21)
    at com.android.tools.r8.internal.r70.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:54)
    at com.android.tools.r8.internal.r70.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:10)
    at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
    at com.android.tools.r8.internal.r70.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:6)
    at com.android.tools.r8.graph.w4$a.d(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:6)
    at com.android.tools.r8.dex.c.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:44)
    at com.android.tools.r8.dex.c.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:12)
    at com.android.tools.r8.dex.c.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:9)
    at com.android.tools.r8.R8.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:52)
    at com.android.tools.r8.R8.c(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:8)
    at com.android.tools.r8.R8.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:1588)
    at com.android.tools.r8.internal.Nu.a(R8_8.9.27_3afcc9fea5cc5cd06373667ec09d5fe106db8a4a77576689534e667542385a93:28)
    ... 4 more


Tip: press Ctrl + R to export IDE state for AI assistants.


These are my libraries
1793000164198.png
 

Attachments

Upvote 0
Ok. I have narrowed it down to FIREBASEADMOB2 by removing the libraries one after the other and compiling.

Removing both these lines SOLVED it. Removing only the dependon line did not solve it

1. <dependsOn>sqlite-2.4.0.aar</dependsOn> from the end of SQLCipherB4A.xml.
2. #AdditionalJar: sqlite-2.4.0.aar

Now: All libraries are working together
Keyvaluestore, SQLCipherB4A, and FirebaseAdmob2

Thank you community
 
Upvote 0
Solution
Back
Top