Android Question ML Kit Language Identification library crashing

CaptKronos

Active Member
Licensed User
Pendrush's demo for his ML Kit Language Identification library (https://www.b4x.com/android/forum/threads/ml-kit-language-identification.130404), crashes immediately on start up. No error is shown in the filtered logs but in the unfiltered logs I am seeing the following:

Log:
FATAL EXCEPTION: main
Process: b4a.example, PID: 25460
java.lang.NoSuchMethodError: No virtual method discoverLazy()Ljava/util/List; in class Lcom/google/firebase/components/ComponentDiscovery; or its super classes (declaration of 'com.google.firebase.components.ComponentDiscovery' appears in /data/app/b4a.example-1/base.apk)
    at com.google.mlkit.common.sdkinternal.MlKitContext.zza(com.google.mlkit:common@@18.0.0:4)
    at com.google.mlkit.common.internal.MlKitInitProvider.onCreate(com.google.mlkit:common@@18.0.0:3)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
    at com.google.mlkit.common.internal.MlKitInitProvider.attachInfo(com.google.mlkit:common@@18.0.0:3)
    at android.app.ActivityThread.installProvider(ActivityThread.java:5180)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4775)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4715)
    at android.app.ActivityThread.access$1600(ActivityThread.java:150)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5444)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:727)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:617)
  Force finishing activity b4a.example/.main
I have tried the demo on two real devices and see the same error.

In case it helps, I have the following installed:
B4X:
com.google.mlkit:language-id   17.0.3

com.google.mlkit:common   18.0.0

androidx.lifecycle:lifecycle-common   2.4.1

com.google.android.gms:play-services-tasks   18.0.1

com.google.firebase:firebase-encoders   16.0.0

com.google.firebase:firebase-encoders-json   17.1.0
 
Last edited:

Pendrush

Well-Known Member
Licensed User
Longtime User
Some of Firebase components are updated in meantime, and this version of B4A, as I can see, don't have support for it.
This my error after added new required Firebase components:
B4A Version: 11.20
Parsing code. (0.00s)
Java Version: 11
Building folders structure. (0.01s)
Compiling code. (0.00s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Compiling resources (0.04s)
Linking resources (0.25s)
Compiling debugger engine code. (0.51s)
Compiling generated Java code. (0.73s)
Convert byte code - optimized dex. Error
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
6 errors; aborting
 
Upvote 0

CaptKronos

Active Member
Licensed User
Thanks for the prompt reply. Are you saying that it is the updated Firebase components causing the problem, or the updated version of B4A? Or you are not sure which? Either way, I guess we will have to wait for future updates.
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
@Pendrush, those errors look like you are using B4A 11.2 with an old version of the SDK. Try a new one.
It's new one, problems is in com.google.firebase:firebase-components or com.google.firebase:firebase-annotations or com.google.mlkit:language-id. Currently I don't have time for some deeper research.
 
Upvote 0

CaptKronos

Active Member
Licensed User
Just to confirm that I have tried with the latest version of both Oracle Java 8 and OpenJDK 11, and am seeing the same result.
 
Upvote 0
Top