2

I have been on this for a few days and haven't found any solution anywhere. Initially startup time was quite long due to multidexing process. I managed to get rid of extra google service libraries which I am not using and get the code small enough (below 2^16 method reference) not to need to multi dex. However when I run and look at the traceview I still see the image below which shows dalvic.system.dexfile starts in main thread and run for about 3 seconds at first. I attached my gradle as well showing multi dex option disabled. Any idea what is causing dalvic.system.DexFile to kick in and how to get rid of it if possible?

EDIT: after further investigation, I am thinking that "Instant Run" could be the cause. Not sure yet! It would certainly be nice if someone could confirm this. Would running instant run cause any initialization upon app startup that could cause delay? and would that be related to dexfile?

EDIT: I did a bit of search on the effects of Instant Run and came across this. It seems instant run does affect the startup time and after some run without instant run my issue seems to be resolved.

enter image description here

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "com.example.main.projectone"
        minSdkVersion 18
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        multiDexEnabled false
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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

...}
Community
  • 1
  • 1
TheBen
  • 3,410
  • 3
  • 26
  • 51

0 Answers0