Skip to content

fix(ai): fallback to bundled TFLite runtime on non-GMS devices#19

Open
qingfeng19491001 wants to merge 1 commit intoREBOOTERS:mainfrom
qingfeng19491001:fix/tflite-init-no-gms
Open

fix(ai): fallback to bundled TFLite runtime on non-GMS devices#19
qingfeng19491001 wants to merge 1 commit intoREBOOTERS:mainfrom
qingfeng19491001:fix/tflite-init-no-gms

Conversation

@qingfeng19491001
Copy link

Fixes #18

Problem

The digit classification demo fails to initialize TensorFlow Lite on devices without Google Play Services.
TfLite.initialize() fails with:
DynamiteModule$LoadingException: No acceptable module com.google.android.gms.tflite_dynamite found.
Local version is 0 and remote version is 0.

Root Cause

The current implementation relies on the Play Services TFLite dynamite module / system runtime, which is unavailable on non-GMS devices.

Changes

  • Treat Play Services TFLite initialization failure as non-fatal.
  • Add a fallback path to use the bundled TFLite runtime when Play Services is unavailable.
  • Add bundled TFLite dependencies to the :subs:ai module.
  • Update related interpreter creation call sites accordingly.

Testing

  • ./gradlew :subs:ai:assembleDebug
  • Manual test on a non-GMS device:
    • Tap init_model -> shows init success
    • Draw digits -> inference works

ec503893072f61b141d8e8d7950ef04e
07a6df6c3c706a8c8ada2d0d4f6cb3a9

@qingfeng19491001
Copy link
Author

Tested on a non-GMS Android device (realme RMX1991). init_model succeeds and digit inference works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DigitalClassifier] 在没有Google Play Services的设备上TFLite初始化失败

1 participant