Open DorisHYC opened 3 years ago
Hi, which version of the TextRecognition sdk did you use? The support for dynamic feature delivery was added in 16.2.0.
I'm using 16.3.0
I tested with 'com.google.mlkit:playstore-dynamic-feature-support:16.0.0-beta1' in the base apk and 'com.google.android.gms:play-services-mlkit-text-recognition:16.3.0' in the dynamic feature module apk but could not repro your issue. Do you have your project hosted somewhere for me to take a look?
Sorry unfortunately I don't. Just wanna double check tho, is there anything else I need to do to load the mlkit library dyanmically except for adding com.google.mlkit:playstore-dynamic-feature-support:16.0.0-beta1
to the base apk?
I think adding playstore-dynamic-feature-support is the only required step. https://developers.google.com/ml-kit/tips/reduce-app-size#advanced_move_optional_ml_features_to_dynamic_feature_modules
I have the same problem with new versions, I switch to 16.3.0
also same problem....
Here's the full error
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ne.test/ com.ne.test.MainActivity}:
java.lang.NullPointerException: Attempt to invoke virtual
method 'com.goog le.mlkit.vision.text.TextRecognizer com.google.mlkit.vision.text.internal.zzk.zza(com.google.mlkit.vision.text.TextRecognizerOptionsInterface)' on a null object reference
at
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3139)
at
android.app.Activity Thread.handleLaunchActivity (Activity Thread.java:3282)
at
android.app.servertransaction.LaunchActivityltem.execute(Launch Activityltem.java:78) at
android.app.servertransaction.Transaction
Executor.executeCallbacks(TransactionExe cutor.java:108)
at
android.app.servertransaction.Transaction Executor.execute(TransactionExecutor.java:
68)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1970)
android.app.ActivityThread.main(ActivityThread.java:7156) at java.lang.reflect.Method.invoke(NativeMethod)
at
com.android.internal.os.Runtimelnit$Metho
dAndArgsCaller.run(Runtimelnit.java:494) at com.android.internal.os.ZygoteInit.main(Zygotelnit.java:975)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.g oogle.mlkit.vision.text. TextRecognizer com.google.mlkit.vision.text.internal.zzk. zza(com.google.mlkit.vision.text.TextRecognizerOptions Interface)' on a null object reference
at
com.google.mlkit.vision.text.TextRecognition.getClient(com.google.android.gms:play-services-mlkit-textrecognition@@16.3.0: 5)
at
com.ne.test.MainActivity.initializeLogic(MainActivity.java:148)
at
com.ne.test.MainActivity.onCreate(MainActivity.java:97)
Anyway I try the above solution but not working... Any solution ? Thanks in advance.
I have the same problem and using the latest version.
I'm working on a feature utilizing Ml Kit text recognition and Translation library. For app size concern, I moved the implementation to a dynamic delivered module, and running
TextRecognition.getClient()
start to give the following error:The same implementation is working properly on the regular module. And I have already included
implementation 'com.google.mlkit:playstore-dynamic-feature-support:16.0.0-beta1
in my base apk. Can someone help to figure out what I'm missing? Thank you!