0

Faced with such a problem that the application compiles for a very long time. I tried to clean the cache - with no result Changed the settings in build.gradle - no result Moreover, I have a similar project in terms of code volume and it compiles on the same configuration files for no more than a couple of minutes.

Profiling

Android Studio Fox 2020.3.1 Patch 3 - AGP 7.0.4 - Gradle 7.0.2 - Kotlin 1.6.21

Halil Ozel
  • 2,482
  • 3
  • 17
  • 32
just_koala
  • 43
  • 1
  • 6
  • How much RAM are you allowing AS and gradle? Have you tried increasing it? – Gabe Sechan Oct 25 '22 at 07:34
  • Android Studio - 4g, Gradle - 2g – just_koala Oct 25 '22 at 07:40
  • Way too low. Increase it, especially gradle. The more you can give it, the better. What happens is it runs out of memory, then begins thrashing. Compilation requires a lot of small objects (tokens and strings) to be allocated constantly. So it will constantly be freeing stuff up, going OOM again, freeing stuff up, going OOM. Performance goes to zero. – Gabe Sechan Oct 25 '22 at 07:53
  • @GabeSechan I set the value to 8g, but apparently this did not help, the compilation has been going on for 27 minutes, still stuck on :app:compileGooglePlayDebugKotlin – just_koala Oct 25 '22 at 08:53
  • Instead of installing all the Google Play services you might want to install only the deps you need. Check this answer https://stackoverflow.com/a/43681342/13088785 – vpuonti Oct 25 '22 at 11:15
  • @vpuonti the project does not have this dependency, only those that are needed, firebase, chastlytics, messages – just_koala Oct 26 '22 at 12:38

2 Answers2

1

Fixed by deleting kotlin-android-extensions and rewrite all code where was it by used

just_koala
  • 43
  • 1
  • 6
-1

Try invalidate cache and restart. if it doesn't work delete .gradle folder under user folder. If it doesnt work too. You can try stable Android Studio version. Because you use canary version it may be real source of problem. You know it is very buggy usually.

Samir Alakbarov
  • 1,120
  • 11
  • 21