| Summary: | cpufeatures module broken on current Android Studio? | ||
|---|---|---|---|
| Product: | SDL | Reporter: | superfury |
| Component: | build | Assignee: | Sylvain <sylvain.becker> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | blocker | ||
| Priority: | P2 | ||
| Version: | 2.0.13 | ||
| Hardware: | x86_64 | ||
| OS: | Android (All) | ||
|
Description
superfury
2020-11-08 16:52:50 UTC
I'm on the latest NDK and Android Studio. Reverting to older NDKs has no effect. Managed to get it compiling somewhat. I've simply commented the following line out in Android.mk from the cpufeatures module: ``` LOCAL_SRC_FILES := cpu-features.c ``` Then, build it(so that Android Studio doesn't index it), uncomment said line to allow compilation to pass, then build again. Afaik this now needs to be repeated every time you load a SDL2 project which uses the cpufeatures module (pretty much any modern SDL2 library using app it seems). Sylvain, I've experienced this as well. Can you look at what's happening here? I don't use Android Studio. Only tried a couple of times to update packages, and java code checks. I haven't been able to build anything. Superfury: can you tell me which folder you open from SDL, and how you build ? On linux, it seems to index correctly. Just googling: maybe using "import project" instead of "open project". "import project" is creating a completely new project based on an existing one? That would pretty much defeat the entire purpose of using an existing project (which is committed in git)? As a little side note: Android Studio after the initial LOCAL_SRC_FILES removal, open it, run make, uncomment the LOCAL_SRC_FILES line and build again, then quit while saving the project steps causes it to apparently no longer search the C:\ drive for the project. It will still compile the cpufeatures module, so there's no problem there atm. One thing that can be noticed, however, is that the Project tab on the left side of Android studio no longer lists neither the C:\ drive nor the cpufeatures module(only hidapi, main, SDL2 and SDL2_net(SDL2_net only when installed in the module directory) in my case). So it's working, but I don't know if the problem might resurface when Android Studio receives another update(it looks like the NDK isn't part of the problem. Downgrading the NDK(using the side-by-side NDK feature) to older versions has no effect on the cpufeatures issue). It looks like the issue has mainly something to do with the new Android Studio 4.1's way of handling things (had no issue until I actually installed the update for 4.1). Perhaps it's a strange little bug inside of Android Studio itself (seeing as the NDK version (using side-by-side loading) doesn't affect things)? The development environment (updating from 4.0(as far as I can remember) to 4.1) seems to be the main culprit somehow. Also, my build steps I follow (other than the special steps mentioned above to bypass the indexing issue) can be found in the README on my app's repository: https://bitbucket.org/superfury/unipcemu.git Although if you're on Linux creating the symbolic directory and file links would need to be done manually(look inside the generatelinks.bat file for how the directories and file are linked for compatiblity with Android Studio). It's basically redirecting the Android Studio java/jni/res folders and AndroidManifest.xml file (in android-studio\app\src\main) to the folders/files in the android-project folder. That's my simple way of keeping compatibility with the old building system (that was used before transitioning to Android Studio). it really sounds to be a bug in the latest Android Studio, maybe it's better to report the bug there so that it can be fixed for the next release. that was the link: not sure if this is really relevant: https://medium.com/@u.adb/android-studio-constantly-indexing-the-project-problem-solution-8d3150d244a3 maybe you can just disable the indexing in the IDE ? I tried running the import step you've mentioned. But it simply ends up hanging the app(gets to 0% CPU usage) when starting the IDE with the import step? Then I did something different: I tried running the app, closed the project, chose from the main screen(where you can choose recently opened projects and setup the Android Studio's basic settings), then chose to update. It found some update for the Kotlin plugin and installed it. Then I tried said option again, after which it actually continued loading using said import option, finding the project and loading as it should. Now just need to fix the NDK, since it can't properly clean the project(ndk-build.cmd fails) or compile SDL(somehow the installed NDK seems to be corrupted now). As for reinstallation of the corrupted NDK, I'm just following the first 8 steps from this tutorial: https://lazyfoo.net/tutorials/SDL/52_hello_mobile/android_windows/index.php Everything after that is specific for my project, which is described in the project's README. Btw I'm on SDL2 commit 14055. The current SDL2 commit has come compilation issues/warnings. An update to Android Studio just came out... Guess what's in it? https://androidstudio.googleblog.com/2020/11/android-studio-411-available.html ``` C++ Issue #171280381: #$(call import-module,android/cpufeatures) in Android.mk will import all files in disk root ``` So a bugfix just came out! :D The Android Studio 4.1.1 update fixes the issue. Great, thanks for the investigation ! |