Can't upload Android app to device (stale dexed jars)

后端 未结 16 505
别跟我提以往
别跟我提以往 2020-12-05 17:11

I am using Android Studio to develop this app, and today when I tried to upload it to my device to test I got a popup window saying:

Installation fail

相关标签:
16条回答
  • 2020-12-05 17:18

    If you're using Android studio 2.0 preview , disable the instant run .

    All credit and thanks go for the life saver https://stackoverflow.com/a/34192979/1413998

    0 讨论(0)
  • 2020-12-05 17:20

    In my project I got past this by being more specific about which portions of Google Play Services I was linking with. In particular, I changed

    dependencies {
        ...
        compile 'com.google.android.gms:play-services:8.4.0'
    }
    

    to

    dependencies {
        ...
        compile 'com.google.android.gms:play-services-maps:8.4.0'
    }
    

    in my app module's build.gradle, since all I was really using was the maps API.

    0 讨论(0)
  • 2020-12-05 17:23

    I have tried followings

    • increasing the RAM
    • increasing the storage of emulator
    • removing and adding emulator
    • invalidate cache and restart

    but nothing work.

    However, deleting the actual emulator file did trick for me.

    You can find the emulator files at this location.

    C:\Users\<username>\.android\avd
    

    Thanks.

    0 讨论(0)
  • 2020-12-05 17:24

    I discovered that the dex file was getting larger than the buffer, even though it contained less than 64k methods. Then I enabled ProGuard and it helped a lot reducing the dex file size.

    THe application dex-method-counts helps a lot to debug your dex file, by checking not only the number of methods, but to what package they belong

    0 讨论(0)
  • 2020-12-05 17:26

    I have also encountered this problem in Android Studio, from version 2.0 Preview 6 all the way up to 2.0 Beta 3 and none of the solutions mentioned here worked for me.

    Turned up it had nothing to do with Instant Run. All I had to do was to increase the AVD's Internal Storage until the following notification disappeared. I also had to perform a data wipe after changing the values.

    0 讨论(0)
  • 2020-12-05 17:27

    I disabled Instant run for this project, and problem solved.

    Maybe it's a bug in the instant run feature of Android studio 2.0 preview.

    Instant Run is a new feature introduced in Android Studio 2.0.

    ps: in case you don't find Instant run, its in:

    Android Studio --> Preferences --> Build, execution, deploy --> Instant run.
    

    or you can search for it in the preferences tab.

    0 讨论(0)
提交回复
热议问题