Closed SusheelNath closed 10 months ago
Hi @SusheelNath, could you look at #269? Changing the API level from 31 to 30 might fix this issue.
I noticed the new app should be API level 31 or higher to submit an app to the Google Play Store.
Adding the following code to the AndroidManifect.xml might fix the issue
<uses-native-library android:name="libOpenCL.so" android:required="false" />
<uses-native-library android:name="libOpenCL-pixel.so" android:required="false" />
References: https://stackoverflow.com/questions/71485371/android-12api-level-31-tflitegpudelegate-invoke-gpudelegate-must-run-on-the https://developer.android.com/about/versions/12/behavior-changes-12#uses-native-library
Hi Koki,
Thank you for your response on this issue. I will try this out and keep you posted.
Warm regards, Susheel
On Mon, Jan 9, 2023 at 10:55 AM Koki Ibukuro @.***> wrote:
I noticed the new app should be API level 31 or higher https://developer.android.com/google/play/requirements/target-sdk to submit an app to the Google Play Store.
Adding the following code to the AndroidManifect.xml might fix the issue
References:
https://developer.android.com/about/versions/12/behavior-changes-12#uses-native-library
— Reply to this email directly, view it on GitHub https://github.com/asus4/tf-lite-unity-sample/issues/263#issuecomment-1375428775, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH7XB5ZTFF6KO7JWHFCGW3DWRPVCHANCNFSM6AAAAAASI32QFU . You are receiving this because you were mentioned.Message ID: @.***>
Hi Koki,
We tried with adding the lines to the AndroidManifest.xml file. The problem still persists, RunBackground = On with API Level 31 - > Not working.
With context as above, this is for Android and with RunBackground = Off with API Level 31 -> it works. On iOS, everything works as intended.
Hi @SusheelNath, did you solve the issue?
Hi @karahanoguzhan I wasn't able to unfortunately.
@asus4 Is there any other pathway that I can try out to solving this?
@SusheelNath Sorry for the wait, I'll look into it when I find the time.
Also, I would appreciate any detailed adb log including the Android model name, version etc to determine the issue.
Hi @SusheelNath @karahanoguzhan, I looked into this today.
On my Androids - tested with Google Pixel 6 and Sony Xperia XZ2, adding the <uses-native-library>
tags in AndroidManifest.xml seems to fix the issues.
In Unity 2021 LTS, the legacy way of creating a file at Plugins/Android/AndroidManifest.xml
seems outdated. Here are detailed steps to build it:
unityLibrary/manifests/AndroidManifest.xml
and add the following lines:
<uses-native-library android:name="libOpenCL.so" android:required="false" />
<uses-native-library android:name="libOpenCL-car.so" android:required="false" />
<uses-native-library android:name="libOpenCL-pixel.so" android:required="false" />
7.2.1
as I got an error "Gradle Scripts/gradle.properties
.
Then, I succeeded in running BlazePose with the background option.
I suppose the reason for this error is the fallback system in the Android GpuDelegate. The default priority of the GpuDelegate is OpenCL, then fallback to OpenGLES if OpenCL is not supported on your device. And as of Android API level 31, you have to add the uses-native-library tag to access the OpenCL library. So the GpuDelegate fallbacks to the OpenGLES, and it throws the error as the OpenGLES requires to run in the same thread.
Could you help us if the above steps also fix the issues on your devices? If it solves the error, we can probably make these changes automatically by implementing IPostGenerateGradleAndroidProject.
Hi @asus4 @karahanoguzhan,
The above fix works. Tried it out on Samsung Galaxy S10FE & Samsung Galaxy S21. Thank you for your efforts in this.
If you could kindly reflect this fix on your repository as well as your UPM packages? It would be a great help not only for our side but also to any other developer who comes across this issue.
Appreciate it and once again, thank you Koki.
Warm regards, Susheel
Hi @asus4, I have given the performance a try with the fix.
Issue: For API Level 31 and even lesser, the RunBackgroundOn performs worse than RunBackgroundOff.
Findings: This is the same findings with your base repository as well.
Background: Earlier in your repository (potentially before the Tensorflow package upgrades?), it used to be the other way around, where RunBackgroundOn used to perform much better than RunBackgroundOff.
Questions: 1) Is there any changes to be done to your code base for this? 2) Was this intended? 3) Is there any steps that can be done from our side to make the performance better? (with any, RunBackgroundOn/Off)
@SusheelNath Is it only happening on Android? If so, it might be related to #243.
There are no clues right now. If we could determine from which commit this slowdown issue happens, we would have a better indication of the cause.
Anyway, can you open a new issue for the performance issue? It looks like a different issue from the API Level.
@asus4 Hi Koki, I will do so. I will create a new thread to mark the performance issue.
I will let you close this issue yourself so that you can keep track of the fix to be implemented in your repository and the packages.
Appreciate your help on this.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I have found a simpler way worth testing it.
https://lightship.dev/docs/ardk/ardk_fundamentals/building_android.html
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi @asus4 , i was wondering if there was a simpler "within unity" solution available for it as I'm facing the same issue after setting target api to 33 as required by Google Play guidelines.
Issue: Works fine in editor but fails to detect body landmarks on Android
Right, would be nice if we could automate the above modification on the Android project in the post-process build.
That's great, eagerly waiting for it :)
I simplified that process at the PR #316. You only need to do is adding the following tags in your custom AndroidManifest.xml 🎉
<uses-native-library android:name="libOpenCL.so" android:required="false"/>
<uses-native-library android:name="libOpenCL-car.so" android:required="false"/>
<uses-native-library android:name="libOpenCL-pixel.so" android:required="false"/>
Hi @asus4 Was able to get it to work. Thanks a lot :)
Environment:
Describe the bug
To Reproduce Steps to reproduce the behavior:
Expected behavior TensorFlowLite BlazePose should work, with RunBackground toggle on, implying smoother experience.
Screenshots (https://user-images.githubusercontent.com/33517815/203538438-22984ef1-a0f9-4987-a3c2-56a8c93a9a1a.jpeg)