igorski / MWEngine

Audio engine and DSP library for Android, written in C++ providing low latency performance within a musical context, while providing a Java/Kotlin API. Supports both OpenSL and AAudio.
MIT License
257 stars 45 forks source link

Android Studio Arctic Fox lib import and generated files workaround #137

Closed scar20 closed 2 years ago

scar20 commented 2 years ago

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?

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...

scar20 commented 2 years ago

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.

igorski commented 2 years ago

Ah crap, I hadn't noticed as the example project doesn't use the AAR but has a dependency upon the core library module. Thanks for the heads up, I updated the README accordingly in 9ed11d229b7591a92b1b01af5a94fab079b4786c