8

I have a multi-module project. With the same build, the apk's size may differ by 300KB (from 17 to 17.3MB). In the build with 17MB in runtime I get an error:

java.lang.AssertionError: Built-in class kotlin.Any is not found.

Also in the project, obfuscation is configured. But I don’t think it’s caused by this. Clean and Invalidate and Restart do not always help.

Mikhail
  • 800
  • 8
  • 21

2 Answers2

3

I encountered this issue, made sure Kotlin stdlib and reflect libraries have the same version, updated Gradle to make sure its not the build too, tried different Kotlin versions as well, but nothing worked. Eventually, I found out that my packageOptions is excluding a Kotlin folder

packagingOptions {
  exclude '**/kotlin/**'
}

Have no idea why this code was there, but removing it solves the problem for me! So definitely check your packageOptions in your module-level build.gradle file.

katie
  • 197
  • 2
  • 11
  • you just saved my day. I have no idea at all why our product develop in kotlin using this "exclude '**/kotlin/**'" – BobTheCat Apr 25 '23 at 17:20
-1

although you said restarting doesn't work, it's the only thing that works for me consistently:

  1. restart Android Studio: File > Invalidate Caches / Restart... > Just Restart
  2. build & run the app again: Shift + F10

...but then the problem comes back again a few builds later.

Eric
  • 16,397
  • 8
  • 68
  • 76