Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running into Missing class org.tensorflow.lite.gpu.GpuDelegateFactory$Options when building an APK #278

Open
dorianbrown opened this issue Feb 12, 2025 · 1 comment

Comments

@dorianbrown
Copy link

I've been putting together a prototype for a tflite model, and although the app is running smoothly in the emulator, I'm running into this error message when trying to build an apk file.

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /home/dorian/StudioProjects/hello_world/build/app/outputs/mapping/release/missing_rules.txt.
ERROR: R8: Missing class org.tensorflow.lite.gpu.GpuDelegateFactory$Options (referenced from: void org.tensorflow.lite.gpu.GpuDelegate.<init>() and 1 other context)

FAILURE: Build failed with an exception.
...

I've tried a number of things, but so far nothing has helped. It seems to be a missing dependency, but it's unclear to me what to add. Also adding tensorflow to proguard-rules.pro didn't help either.

Anyone else ran into this and solved it?

@dorianbrown
Copy link
Author

Of course as soon as you post an issue, you figure out the solution. Following some suggestions in this thread, adding this to android/app/build.gradle ended up solving it:

dependencies {
    implementation "org.tensorflow:tensorflow-lite-gpu-api:+"
}

Possibly a missing dependency somewhere in tflite_flutter?

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

No branches or pull requests

1 participant