Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kotlin runtime error kotlin.Any is not found

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.

like image 363
Mikhail Avatar asked Nov 08 '19 13:11

Mikhail


1 Answers

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.

like image 66
katie Avatar answered Jan 02 '23 12:01

katie