# Kotlin apps can't work with recent versions of Guice/Guava

**URL:** <https://discuss.kotlinlang.org/t/kotlin-apps-cant-work-with-recent-versions-of-guice-guava/191>\
**Category:** Uncategorized\
**Created:** [July 27, 2015, 9:50pm UTC](https://discuss.kotlinlang.org/t/kotlin-apps-cant-work-with-recent-versions-of-guice-guava/191 "2015-07-27T21:50:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cedricbeust](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/cedricbeust/32/1429_2.png) [@cedricbeust](https://discuss.kotlinlang.org/u/cedricbeust)\
**Post date:** [July 27, 2015, 9:50pm UTC](https://discuss.kotlinlang.org/t/kotlin-apps-cant-work-with-recent-versions-of-guice-guava/191/1 "2015-07-27T21:50:07Z")

</div>

Reproducing below [a ticket I just filed]([https://youtrack.jetbrains.com/issue/KT-8638](https://youtrack.jetbrains.com/issue/KT-8638)):

My application uses Guice 4.0 and Guava 18.0 and `./gradlew run` fails with:

```auto
$ ./gradlew run
:compileKotlin UP-TO-DATE
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:run
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;[Ljava/lang/Object;)V
at com.google.common.cache.CacheBuilder.setKeyStrength(CacheBuilder.java:520)
at com.google.common.cache.CacheBuilder.weakKeys(CacheBuilder.java:516)
at com.google.inject.internal.WeakKeySet.&lt;init&gt;(WeakKeySet.java:55)

```

This is happening because `kotlin-compiler-0.12.1218.jar' includes `com.google.comm.base.Preconditions` without shading it:

```auto
$ jar tf ~/.kobalt/repository/org/jetbrains/kotlin/kotlin-compiler/0.12.1218/kotlin-compiler-0.12.1218.jar|grep Preconditions
com/google/common/base/Preconditions.class

```

As a result, Kotlin apps can’t currently use recent versions of Guava or Guice.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![sharmaabhishekit](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@sharmaabhishekit](https://discuss.kotlinlang.org/u/sharmaabhishekit)\
**Post date:** [December 13, 2017, 1:15am UTC](https://discuss.kotlinlang.org/t/kotlin-apps-cant-work-with-recent-versions-of-guice-guava/191/2 "2017-12-13T01:15:16Z")

</div>

+1 Were there any solutions to this?

---

<div class="post-metadata">

**Author:** ![hmhagberg](https://avatars.discourse-cdn.com/v4/letter/h/848f3c/32.png) [@hmhagberg](https://discuss.kotlinlang.org/u/hmhagberg)\
**Post date:** [December 15, 2017, 12:35pm UTC](https://discuss.kotlinlang.org/t/kotlin-apps-cant-work-with-recent-versions-of-guice-guava/191/3 "2017-12-15T12:35:19Z")

</div>

[kotlin-compiler-embeddable](https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-compiler-embeddable) should work
