Android Studio Arctic Fox lib import and generated files workaround
scar20 opened this issue · 2 comments
Here I share my findings for a workaround that solve two problems kindly provided by the new version of Android Studio:
Cannot find Java classes in nl.igorski.mwengine.core generated files and all the MWEngineExample code is red?
Cannot import aar?
- First run the ":mwengine:assemble" task as stated in README.md
- Create a "libs" folder in "mwengine_example" project (under "project" view)
- Copy (via Android Studio) one of the .aar lib in the "mwengine" project - here I use mwengine/build/output/aar/mwengine-debug.aar
- Paste it (via Android Studio) in the new "libs" folder of the "mwengine_example" project
- Now change the line "implementation project(':mwengine')" to implementation files('libs/mwengine-debug.aar') in the build.gradle of the "mwengine_example" project
- Then sync project
Now it should be fine. For importing the library into another project, just do the same by copying manually the lib into your project since importing via the IDE is not working. This should be a temporary workaround until Google fix this IDE that should never have been released before fixing those breaks of basic functionalities.
In previous versions of Android Studio, I had the pesky "Cannot find Java classes in nl.igorski.mwengine.core" from time to time which seem to solve by itself without I've been able to know exactly how it resolve - annoyance. With the new version, it hit as soon there was a gradle sync in "mwengine_example" project in a systematic way and nothing could get rid of it, even swapping SWIG 4.0.2 to 3.0.12 - a very big bug, render the IDE useless.
I though then to build the project against the produced .aar. From Android Studio File->New->New Module->Import... STUCK! No import aar/jar option! Just gradle/eclipse source directory - and furthermore, this option for those who need it, is bugged as the Next button stay unabled - see on stackoverflow:
https://stackoverflow.com/questions/68636809/cant-import-module-in-android-studio-arctic-fox/68738929#68738929
https://stackoverflow.com/questions/66598542/importing-an-existing-jar-or-aar-as-new-project-module
and Google IssueTracker:
https://issuetracker.google.com/issues/195336461
I have tested this workaround many times starting from scratch before posting this. And as a note, maybe that doesn't help but I'm on Windows 10...
Update...
It seem that they simply decided to change the way to import .aar file in Android Studio ArcticFox. No more File > New Module > import jar/arr package... Igor, you'll have to update the README.md.....
From Google Issue Tracker: https://issuetracker.google.com/issues/192776772
The official new way: https://developer.android.com/studio/projects/android-library?hl=fr
As for the editor that cannot see the core classes, I filed a bug report in Google Issue Tracker:
https://issuetracker.google.com/issues/210687952
Let see what they will make of it.