Blank screen with multidex in android 4.0.3

486 Views Asked by At

I have an application which supports android version from 4.0.3 up to 6.0 and it has reached the total amount of allowed methods in application and it forced me enabling multidex feature.

The application has support for swipe to dismiss feature and I was using a component named EnhancedListView. This library was causing several issues and I replaced it with RecyclerView.

After that device (Dolphing black - android 4.0.3) stopped working. When I run application I get a white screen followed by ANR and a log message informing that VM 1.6 does not support multidex.

I confirmed in android shell that this device is running under VM 1.6 as shown in image below: enter image description here

But that information is contradictory since before replacing EnhancedListView by RecyclerView multidex was working.

Below follows the logcat displayed after running application

02-02 15:42:48.375 15011-15011/? D/dalvikvm: Late-enabling CheckJNI
02-02 15:42:48.648 15011-15011/my_package I/MultiDex: VM with version 1.6.0 does not have multidex support
02-02 15:42:48.648 15011-15011/my_package I/MultiDex: install
02-02 15:42:48.656 15011-15011/my_package I/MultiDex: MultiDexExtractor.load


02-02 15:42:48.679 15011-15011/my_package I/MultiDex: Detected that extraction must be performed.
02-02 15:42:48.750 15011-15012/my_package D/dalvikvm: GC_CONCURRENT freed 225K, 4% free 9369K/9671K, paused 5ms+5ms
02-02 15:42:48.781 15011-15011/my_package I/MultiDex: Extraction is needed for file /data/data/my_package/code_cache/secondary-dexes/pkg.apk.classes2.zip
02-02 15:42:48.781 15011-15011/my_package I/MultiDex: Extracting /data/data/my_package/code_cache/secondary-dexes/pkg.apk.classes495678859.zip
02-02 15:42:49.523 15011-15011/my_package I/MultiDex: Renaming to /data/data/my_package/code_cache/secondary-dexes/pkg.apk.classes2.zip
02-02 15:42:49.523 15011-15011/my_package I/MultiDex: Extraction success - length /data/data/my_package/code_cache/secondary-dexes/pkg.apk.classes2.zip: 367576
02-02 15:42:49.531 15011-15011/my_package I/MultiDex: load found 1 secondary dex files
02-02 15:42:49.531 15011-15011/my_package I/MultiDex: install done
02-02 15:42:49.531 15011-15011/my_package I/MultiDex: install
02-02 15:42:49.648 15011-15011/my_package D/AndroidRuntime: Shutting down VM
02-02 15:42:49.648 15011-15011/my_package W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x40a331f8)
02-02 15:42:49.656 15011-15011/my_package E/info: java.io.PrintWriter@413d2ea0

And here is my gradle file:

buildscript {
        repositories {
            maven { url 'https://maven.fabric.io/public' }
            jcenter()
            mavenCentral()
        }

        dependencies {
            classpath 'io.fabric.tools:gradle:1.19.2'
        }
    }
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    jcenter()
    mavenCentral()
}

Properties props = new Properties()
props.load(new FileInputStream(file('signing.properties')))

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    delete('src/main/res/values/com_crashlytics_export_strings.xml')

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    defaultConfig {
        applicationId "my_package"
        minSdkVersion 15
        targetSdkVersion 23

        // Enabling multidex support.
        multiDexEnabled true
    }

    flavorDimensions "type", "environment"

    dexOptions {
        javaMaxHeapSize "5g"
        incremental true
        preDexLibraries false
    }

    lintOptions {
        abortOnError false
    }

    signingConfigs {
        release {
            storeFile file("../../MyAppQA.keystore")
            storePassword props['signing.release.storePassword']
            keyAlias props['signing.release.keyAlias']
            keyPassword props['signing.release.keyPassword']
        }
    }

    productFlavors {
        ...
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            signingConfig signingConfigs.release
        }
    }
}
apply plugin: 'com.android.application'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-base:6.5.87'
    compile 'com.google.android.gms:play-services-location:6.5.87'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
        transitive = true;
    }
    compile 'com.android.support:multidex:1.0.1'
}

PS: Replacing EnhancedListView by RecyclerView was just a tip but the main focus here is multidex support.

Can anybody help me with that?
Regards,

0

There are 0 best solutions below