I am trying to move some business logic from my iOS apps to KMM. I have already made some job when suddenly started having problems with studio. It was not building, there were weird metaspace
errors, etc. I was beating around my project for several hours and days to be honest - no result. I decided to completely uninstall studio and all its dependent files.
After that I'm not even able to properly build an empty KMM project. Simple Android projects work just fine. Problems occur only with KMM. When I have created a project for the first time, it has loaded successfully, downloaded all the dependencies and synced. I was able to see "Android" project structure. I tried to build it via ./gradlew build
- error. There was no complete description, only the name of the failed task - compile kotlin to ios arm64
. An error in a completely new project. I tried rebuilding project - no luck. So I restarted studio and here the second part of magic begins.
From this moment whenever I open a new or existing KMM project, it starts syncing and stucks. I can't open project structure for example, because sync is in progress, I can't add dependencies, because sync is in progress. But I can build it via ./gradlew build
and it builds! Well, I tried some more commands, like ./gradlew -refresh-dependencies
etc. It was building successfully. And then at some point all the code became red. Below you can see all the colors of Android Studio at the same time:
In the terminal you can see that it was built successfully. In the lower right corner you can see that it doesn't allow to go to the project structure because of sync in progress. And the most beautiful are all that unresolved symbols.
I believe I have tried the most of these Android Studio things:
- Invalidate cache & restart
- Just restart
- Rebuild project
./gradlew clean build
- Deleting ~/.gradle and ./gradle and rebuild
- Restarting the laptop
- Updating all plugins
etc.
Guys, do you have any ideas how can I make studio just work with KMM? And then how should I make it keep working? As I've already said, the problem is not studio specific, it is KMM specific, because regular android projects build just fine.
Android Studio 4.1.2
Mac OS Big Sur 11.2
Kotlin 1.4.30-release-Studio4.1-1
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…