# install\_failed\_dexopt

**URL:** <https://discuss.kotlinlang.org/t/install-failed-dexopt/693>\
**Category:** Uncategorized\
**Created:** [December 2, 2013, 9:08am UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693 "2013-12-02T09:08:21Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![programingjd](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/programingjd/32/1526_2.png) [@programingjd](https://discuss.kotlinlang.org/u/programingjd)\
**Post date:** [December 2, 2013, 9:08am UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/1 "2013-12-02T09:08:21Z")

</div>

We have a fairly large android project all written in kotlin.

When moving from Kotlin 0.6.1315 to 0.6.1411, we get an error when trying to install the generated apk:  
Failure [INSTALL\_FAILED\_DEXOPT]

12-02 08:46:52.668 &nbsp;&nbsp;2765-2765/? E/dalvikvm﹕ Out-of-order method\_idx: 0x1ba9 then 0x1ba9  
12-02 08:46:52.668 &nbsp;&nbsp;2765-2765/? E/dalvikvm﹕ Trouble with item 652 @ offset 0x166c34  
12-02 08:46:52.668 &nbsp;&nbsp;2765-2765/? E/dalvikvm﹕ Swap of section type 2006 failed  
12-02 08:46:52.668 &nbsp;&nbsp;2765-2765/? E/dalvikvm﹕ ERROR: Byte swap + verify failed  
12-02 08:46:52.678 &nbsp;&nbsp;2765-2765/? E/dalvikvm﹕ Optimization failed

It looks like the byte code generated by this new version of Kotlin has changed and includes  
something that dex doesn’t like.

We’ve had this error before, but it was introduced by changes in our code so we could track it down  
to a specific commit and isolate the troubling code. Usually it was because of having a property called  
prop when there was already an inherit method called getProp() or setProp() somewhere in the class  
hierarchy.

This time however, the error is introduced by a change in kotlin version, so we can’t track what’s the  
specific code that is causing the problem. Our project is just too large.

I will try to track to narrow the search to the specific version of kotlin where the version starts.

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [December 2, 2013, 9:15am UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/2 "2013-12-02T09:15:13Z")

</div>

Could you show us the code so that we can reproduce the problem?

---

<div class="post-metadata">

**Author:** ![programingjd](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/programingjd/32/1526_2.png) [@programingjd](https://discuss.kotlinlang.org/u/programingjd)\
**Post date:** [December 2, 2013, 9:33am UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/3 "2013-12-02T09:33:55Z")

</div>

This is a large project with multiple modules and I can't tell where the problem comes from because the error message only comes when installing the final apk. I am not sure sending you megabytes of code would be much help. I'll try to figure out exactly what version of kotlin introduced the problem and that should help pinpoint what change in kotlin introduced the problem. If that's not enough, then we'll see if there's something I can send to help track it down further.

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [December 2, 2013, 9:39am UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/4 "2013-12-02T09:39:45Z")

</div>

Another thing that could help: you mentioned that similar messages arose after some changes in your code. If you could tell us what those changes were, it might be a clue as well. Thanks.

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [December 2, 2013, 9:46am UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/5 "2013-12-02T09:46:21Z")

</div>

Oh, sorry, you mentioned what the problem was above.

If the cause is the same (i.e. Kotlin now generates some clashing methods), we sould find it by simply reading the binaries of your project (i.e. class files)

---

<div class="post-metadata">

**Author:** ![programingjd](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/programingjd/32/1526_2.png) [@programingjd](https://discuss.kotlinlang.org/u/programingjd)\
**Post date:** [December 2, 2013, 10:31am UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/6 "2013-12-02T10:31:35Z")

</div>

The problem is already there with 0.6.1344.

I would have liked to try 1320, 1329, 1336 and 1338 but the “View” dropdown that I use to download old builds on the build server page is missing for those ones.  
Is there another place where I could get those builds?

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [December 2, 2013, 10:42am UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/7 "2013-12-02T10:42:51Z")

</div>

Unfortunately, the older builds are gone, for the buildserver only stores artifacts of so many builds. Could you try 1287 (it has been manually pinned and will now be kept forever)?

---

<div class="post-metadata">

**Author:** ![programingjd](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/programingjd/32/1526_2.png) [@programingjd](https://discuss.kotlinlang.org/u/programingjd)\
**Post date:** [December 2, 2013, 10:44am UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/8 "2013-12-02T10:44:51Z")

</div>

Sure, but I expect it will work since 1315 (from maven) does work.

---

<div class="post-metadata">

**Author:** ![programingjd](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/programingjd/32/1526_2.png) [@programingjd](https://discuss.kotlinlang.org/u/programingjd)\
**Post date:** [December 2, 2013, 11:07am UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/9 "2013-12-02T11:07:24Z")

</div>

1287 -\> works 1315 (maven) -\> works 1344 -\> doesn't work 1364 -\> doesn't work 1381 -\> doesn't work 1411 (maven) -\> doesn't work 1507 (maven) -\> doesn't work

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [December 2, 2013, 1:32pm UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/10 "2013-12-02T13:32:29Z")

</div>

I suspect that the error is introduced in 1320, will try to build it again.

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [December 2, 2013, 2:17pm UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/11 "2013-12-02T14:17:42Z")

</div>

Could you check this build?

[http://teamcity.jetbrains.com/viewLog.html?buildId=105146&buildTypeId=bt345&tab=artifacts](http://teamcity.jetbrains.com/viewLog.html?buildId=105146&buildTypeId=bt345&tab=artifacts)

(it’s built from sources identical to 1320)

Thanks

---

<div class="post-metadata">

**Author:** ![programingjd](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/programingjd/32/1526_2.png) [@programingjd](https://discuss.kotlinlang.org/u/programingjd)\
**Post date:** [December 2, 2013, 2:40pm UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/12 "2013-12-02T14:40:31Z")

</div>

I am getting the error with this build.

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [December 2, 2013, 2:58pm UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/13 "2013-12-02T14:58:18Z")

</div>

Ok, thanks, now we know what functionality is causing the problem, but we do not know how.

We will experiment a little, and you can help us by

- checking if classes org.jetbrains.annotations.Nullable and org.jetbrains.annotations.NotNull are present in the apk that fails to install.
- sharing your binaries with us (we can do it privately)

Thanks a lot for your help!

---

<div class="post-metadata">

**Author:** ![programingjd](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/programingjd/32/1526_2.png) [@programingjd](https://discuss.kotlinlang.org/u/programingjd)\
**Post date:** [December 2, 2013, 3:10pm UTC](https://discuss.kotlinlang.org/t/install-failed-dexopt/693/14 "2013-12-02T15:10:50Z")

</div>

Yes, NotNull.class and Nullable.class are both in there. Please send me information on how I can share the jar privately at contact at jdavid dot info Thank you.
