I am trying to create a sudoku app with C , SDL2 and Android Studio NDK.
In theory it is already working well unless I build and install the app manually.
While I get around 50-60 FPS when I run the app with the RUN-Button in Android Studio, there is a major performance drop when I install the app via BUILD -> GENERATE SIGNED BUNDLE / APK... -> APK and put it on the SD-Card on an actual android device (I've testet this on Xiaomi Mi A1, Samsung Tab S3 and some older devices). I get around 9-11 FPS when installing the app manually.
To create the project, I used the template project in the SDL2 package (version 2.0.18).
I use the same (release-)Build Variant for both cases.
The app is build via NDK-Build.
My conclusion is, that while my code for rendering is maybe not the most efficient, it is not the problem which causes this massive performance issue here.
Screenshot: build with RUN
Screenshot: build with BUILD -> GENERATE SIGNED BUNDLE / APK... -> APK
I already tried change several build settings, including switching between debug and release mode, adding optimization (C and C -)flags in the Application.mk file, build with uncompressed assets. The performance stays the same in both cases.
My Question is: What could be the difference between building the APK and clicking on RUN, which causes this performance issue?
I hope someone can help me out here, because I am very clueless at the moment. Thank you in advance.
CodePudding user response:
The difference between RUN and BUILD is in my Run-configuration.
Under Installation Options -> Deploy I chose "APK from app bundle". After researching and trying for hours I changed it to "Default APK", which caused the same performance problems as building and manual install as described in my question above.
While I still don't really know why this is the case, I found a way to get an APK-file which, at least for now, works for me:
Instead of building with BUILD -> GENERATE SIGNED BUNDLE / APK... -> APK I now choose BUILD -> GENERATE SIGNED BUNDLE / APK... -> ANDROID APP BUNDLE and convert the app bundle to an APK via bundletool (https://developer.android.com/studio/command-line/bundletool). The converted APK runs fine on my android device.