Java Question Firebase InAppMessaging and Dagger dependency

DonManfred

Expert
Licensed User
Longtime User
I´m trying to do a wrap for Firebase InAppMessaging (which is currently still in Beta)
The library is using
B4X:
@DependsOn(values={
    "com.google.firebase:firebase-inappmessaging",
    "com.google.firebase:firebase-inappmessaging-display" 
})

When reloading the Librarytab i get an error missing com.google.dagger:dagger

I then tried to add it manually in the SDK

i added the folder Dagger to Android.readytorunsdk\extras\b4a_remote\com\google\

and added
B4X:
com.google.dagger\:dagger=2.23.2
com.google.dagger\:dagger-android=2.23.2
to the installed-components.txt

It works but it then requests another dependency:
B4X:
com.google.dagger\:dagger-android-support=2.23.2
I added them too. See the updated content of the dagger-folder attached.

Are .androidx.jar/aar recognized and used in the maven-artifacts inside the b4a_remote folder?

I guess it is the dependecy to dagger-android or dagger-android-support which are not fetified by default (download from maven). i copied them to addlibs folder and run the jetifier tool to get the androidx.* for them and added them to the dagger folder.

I tried it in a new project using just the wrapper with the DependsOn seen above.
The new project does not have any active additionaljar lines.
B4X:
'#AdditionalJar: com.google.dagger:dagger
'#AdditionalJar: com.google.dagger:dagger-android
'#AdditionalJar: com.google.dagger:dagger-android-support

'#AdditionalJar: com.google.firebase:firebase-core
'#AdditionalJar: com.google.firebase:firebase-common
'#AdditionalJar: com.google.gms:google-services
'#AdditionalJar: com.google.firebase:firebase-iid
'#AdditionalJar: com.google.firebase:firebase-abt
'#AdditionalJar: com.google.firebase:firebase-inappmessaging-display
'#AdditionalJar: com.google.firebase:firebase-inappmessaging
'#AdditionalJar: com.google.android.datatransport:transport-api
'#AdditionalJar: com.google.android.datatransport:transport-runtime
'#AdditionalJar: dagger-2.23.jar
'#AdditionalJar: dagger-android-2.23.2.aar
'#AdditionalJar: dagger-android-support-2.22.1.aar
'#AdditionalJar: guice-4.2.2.jar
'#AdditionalJar: javax.inject-1.jar
'#AdditionalJar: javax.servlet-api-4.0.1.jar
'#AdditionalJar: rxjava-2.2.9.jar
'#AdditionalJar: rxandroid-2.1.1.aar
'#AdditionalJar: rxjava-reactive-streams-1.2.1.jar
'#AdditionalJar: reactive-streams-1.0.2.jar
'#AdditionalJar: picasso-2.71828.aar
'#AdditionalJar: okhttp-2.7.5.jar
'#AdditionalJar: grpc-protobuf-lite-1.20.0.jar
'#AdditionalJar: grpc-android-1.21.0.aar
'#AdditionalJar: grpc-core-1.21.0.jar
'#AdditionalJar: grpc-stub-1.21.0.jar
'#AdditionalJar: grpc-services-1.21.0.jar

'#AdditionalJar: opencensus-api-0.20.0.jar
'#AdditionalJar: transport-runtime-1.0.0.aar

But i run into
B4A Version: 9.30 BETA #4
Java Version: 8
Parsing code. (0.00s)
Building folders structure. (0.01s)
Compiling code. (0.01s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. Error
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:72: error: Attribute "navigationMode" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:74: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:81: error: Attribute "displayOptions" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:82: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:252: error: Attribute "tintMode" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:255: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:279: error: Attribute "tickMarkTintMode" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:282: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:314: error: Attribute "autoSizeTextType" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:314: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:434: error: Attribute "actionBarSize" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:435: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:737: error: Attribute "buttonTintMode" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:740: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:802: error: Attribute "showDividers" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:803: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:876: error: Attribute "alphabeticModifiers" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:877: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:891: error: Attribute "numericModifiers" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:892: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:918: error: Attribute "showAsAction" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:921: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:966: error: Attribute "iconTintMode" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:969: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:1110: error: Attribute "thumbTintMode" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:1113: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:1134: error: Attribute "trackTintMode" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:1137: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:1219: error: Attribute "buttonGravity" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:1221: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\appcompat\appcompat\1.0.2\unpacked-appcompat-1.0.2\res\values\values.xml:1275: error: Attribute "backgroundTintMode" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\appcompat-v7\28.0.0\unpacked-appcompat-v7-28.0.0\res\values\values.xml:1278: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\coordinatorlayout\coordinatorlayout\1.0.0\unpacked-coordinatorlayout-1.0.0\res\values\values.xml:28: error: Attribute "layout_anchorGravity" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\coordinatorlayout\28.0.0\unpacked-coordinatorlayout-28.0.0\res\values\values.xml:30: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\coordinatorlayout\coordinatorlayout\1.0.0\unpacked-coordinatorlayout-1.0.0\res\values\values.xml:67: error: Attribute "layout_insetEdge" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\coordinatorlayout\28.0.0\unpacked-coordinatorlayout-28.0.0\res\values\values.xml:67: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\coordinatorlayout\coordinatorlayout\1.0.0\unpacked-coordinatorlayout-1.0.0\res\values\values.xml:84: error: Attribute "layout_dodgeInsetEdges" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\coordinatorlayout\28.0.0\unpacked-coordinatorlayout-28.0.0\res\values\values.xml:86: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\core\core\1.0.2\unpacked-core-1.0.2\res\values\values.xml:36: error: Attribute "fontProviderFetchStrategy" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\support-compat\28.0.0\unpacked-support-compat-28.0.0\res\values\values.xml:42: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\core\core\1.0.2\unpacked-core-1.0.2\res\values\values.xml:51: error: Attribute "fontProviderFetchTimeout" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\support-compat\28.0.0\unpacked-support-compat-28.0.0\res\values\values.xml:54: Original attribute defined here.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\androidx\core\core\1.0.2\unpacked-core-1.0.2\res\values\values.xml:61: error: Attribute "fontStyle" already defined with incompatible format.
e:\android.readytorunsdk\tools\..\extras\b4a_remote\com\android\support\support-compat\28.0.0\unpacked-support-compat-28.0.0\res\values\values.xml:62: Original attribute defined here.
when trying to compile the project.

My fear is that the .androidx.jar/aar are not used inside the b4a_remote folder. Due to this i guess it is fetching the jar/aar which depends on "old" Support-classes and due to this b4a is using the old support appcompat resourcefolder. Just a thought as i can not figure out where reference for the old support classes are coming from.

I tried to use the jars directly in the additional libs folder but it always stops with a missing dependency when reloading the libraries.
I got rid of this problem with adding the mavens to the SDK and patching the installed-components.
I also got Firebase Firestore running this way.

But here my fear is that the jetified jars (if available in the SDK) are not used.

Any thoughts/hints/advices are welcome :)
 

Attachments

  • dagger.zip
    104.2 KB · Views: 399
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
I recommend you to only support androidx in this case as the dependencies will be quite complicated.

I'm able to compile with these references:
B4X:
#AdditionalJar: com.google.firebase:firebase-inappmessaging
#AdditionalJar: dagger-2.23.2.jar
#AdditionalJar: dagger-android-2.23.2.aar
#AdditionalJar: dagger-android-support-2.23.2.aar

I've copied the three attached jars to the additional libs folder. The first two are just stubs to prevent the compiler from throwing an error about missing references.

You will probably need to add more references to make it actually work.
 

Attachments

  • com.google.dagger-dagger.zip
    418 bytes · Views: 447
  • com.google.protobuf-protobuf-lite.jar
    240.7 KB · Views: 425
Top