Instant Run in Android Studio 2.0 build a strange apk without classes.dex

218 views
Skip to first unread message

Dalyc Stc

unread,
Mar 9, 2016, 12:58:47 PM3/9/16
to adt-dev

well,the figure above is the strange apk, you can see no classes.dex in it.(oh,no...i can't believe it.) and if i try to install it, it will throw "Failure [INSTALL_FAILED_DEXOPT]" error.(of course)


a normal apk file should look like:(well,you can see a classes.dex, actually the normal apk is built by the android sample code.)


i don't know why my project lose the classes.dex...here are my build.gradle...

my project use AndrdoidAnnotation framework and use the feature multiDexEnabled true.


buildscript {
 repositories
{
 jcenter
()
 
}
 dependencies
{
 classpath
'com.android.tools.build:gradle:2.0.0-beta6'
 classpath
'com.neenbedankt.gradle.plugins:android-apt:1.8'
 classpath
'com.tencent.bugly:symtabfileuploader:1.2.7'
 
}
}

allprojects
{
 repositories
{
 jcenter
()
 
}
}

apply plugin: 'com.android.application'
apply plugin: 'android-apt'
def AAVersion = '3.3.2'

apply plugin: 'bugly'  
bugly {
    appId
= '**********'    
    appKey = '************'  
}

android
{
    useLibrary
'org.apache.http.legacy'
    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    defaultConfig {
        applicationId
"**********"
        minSdkVersion 10
        targetSdkVersion 23
        versionCode 8
        versionName "1.0.4.6"
        multiDexEnabled true
        ndk {
            abiFilters
'armeabi', 'x86'
        }
   
}

    productFlavors
{
        dev
{
            minSdkVersion 21
        }
        prod
{
           
// The actual minSdkVersion for the application.
            minSdkVersion 10
        }
   
}

    dexOptions
{
        javaMaxHeapSize
"4g"
        preDexLibraries = false
    }

    buildTypes
{
        release
{
            minifyEnabled
true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-easemob.pro', 'proguard-spring.pro', 'proguard-gson.pro'
        }
   
}
}

dependencies
{
    compile fileTree
(include: ['*.jar'], dir: 'libs')

    testCompile
'junit:junit:4.12'
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
    compile project(':extra:Android-PullToRefresh')
    compile project
(':extra:ViewPagerIndicator')
    compile project
(':extra:sweetalertdialoglibrary')
    compile
'com.tencent.bugly:crashreport:1.2.8'
    compile 'com.google.code.gson:gson:2.5'
    compile 'com.squareup.okhttp3:okhttp:3.0.0-RC1'
    compile 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.commit451:PhotoView:1.2.4'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:design:23.1.1'
}

apt
{
    arguments
{
        androidManifestFile variant
.outputs[0]?.processResources?.manifestFile
    }
}




i also find a guy with a same problem:http://comments.gmane.org/gmane.comp.handhelds.android.devel/244515
oh, the problem drives me crazy.. thanks in advance.

Siva Velusamy

unread,
Mar 9, 2016, 4:56:29 PM3/9/16
to adt...@googlegroups.com
Our current approach to instant run involves putting all the classes.dex into the instant-run.zip file that you see. If you unzip that, then you'll see the dex files.

--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jerome Dochez

unread,
Mar 9, 2016, 5:05:11 PM3/9/16
to adt...@googlegroups.com
although Siva is right for the application code , we still have a small bootstrap code that is shipped in the classes.dex so you found a bug.
can you set preDexLibraries to true and try again. 

thx
Reply all
Reply to author
Forward
0 new messages