Android Question Firebase Vision ML Kit

vpires

Member
Licensed User
Hello,

i am stuck with the new Firebase Vision ML Kit. After getting all the required dependencies with the sdkmanager (at least i think they are the required ones, by looking at the compile dependencies at https://mvnrepository.com), i am able to compile the attached small project.
My problem is that FirebaseVision.getInstance() is always null.

Best guess is that some wrong version of the dependencies is being used. The exact same inline java code works as expected in android studio...


TIA
Nelson
 

Attachments

Last edited:

Erel

Administrator
Staff member
Licensed User
Add this at the end of the manifest editor:

B4X:
AddApplicationText(
 <service android:name="com.google.firebase.components.ComponentDiscoveryService" >
            <meta-data
                android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
            <meta-data
                android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
             <meta-data
                android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
             <meta-data
                android:name="com.google.firebase.components:com.google.firebase.storage.StorageRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
            <meta-data
               android:name="com.google.firebase.components:com.google.firebase.firestore.FirestoreRegistrar"
               android:value="com.google.firebase.components.ComponentRegistrar"/>

           <meta-data
                    android:name="com.google.firebase.components:com.google.firebase.database.DatabaseRegistrar"
                    android:value="com.google.firebase.components.ComponentRegistrar"/>
                 <meta-data
                android:name="com.google.firebase.components:com.google.firebase.ml.common.CommonComponentRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
                android:name="com.google.firebase.components:com.google.firebase.ml.vision.VisionRegistrar"
                android:value="com.google.firebase.components.ComponentRegistrar" />
</service>

)
 

vpires

Member
Licensed User
Thank you very much Erel. The two extra meta-data tags were the solution.

In case anybody needs it, here's a very simple project that extracts all the barcodes found in a bitmap. ML vision seems very good to do it. In the sample, there is even a rotated aztec barcode and there is no problem with it.
All that you need is your own google-services.json.

tks again.
 

Attachments

Top