Java.lang.ClassCastException: Android.support.v7.widget.ContentFrameLayout cannot be cast to Android.support.v7.widget.ContentFrameLayout

Viewed 2660

There are times when I install my Android app and I get the following exception but this isn't always reproducible.

java.lang.ClassCastException: android.support.v7.widget.ContentFrameLayout cannot be cast to android.support.v7.widget.ContentFrameLayout

I am using multidex on my Android app and I read this question about Samsung devices having a bug with the multidex implementation but this happens on LG G3 running 5.1 and an HTC A9 running 6.0.

Anyone have any ideas why this is randomly happening and what can I do to fix it?

EDIT: I can't share much of the code because this is for a company I work for.

buildscript {
repositories {
    mavenCentral()
}

dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}

}

apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt'

buildscript { repositories { mavenCentral() }

dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}

}

apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt'

repositories { mavenCentral() maven { url 'https://repository-achartengine.forge.cloudbees.com/snapshot' } maven { url 'libs-localrepository' } }

android { buildToolsVersion "23.0.2" compileSdkVersion 23

dexOptions {
    javaMaxHeapSize "4g"
}

defaultConfig {
    minSdkVersion 18
    targetSdkVersion 23
    multiDexEnabled true
}

packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/INDEX.LIST'
}

lintOptions {
    ignore 'ProtectedPermissions'
}

signingConfigs {

    release {
        storeFile file("somepath...")
        storePassword System.getenv("some_password")
        keyAlias "release"
        keyPassword System.getenv("some_password")
    }
}

buildTypes {

    release {
        minifyEnabled false
        proguardFile getDefaultProguardFile('proguard-android.txt')
        proguardFile 'proguard-config.txt'
    }

    debug {
        minifyEnabled false
        proguardFile getDefaultProguardFile('proguard-android.txt')
        proguardFile 'proguard-config.txt'
    }
}

dependencies {

    compile 'com.android.support:multidex:1.0.0'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.0'
    compile 'com.android.support:preference-v14:23.1.0'

    compile ('com.m.c:CE:1.0') {
        changing=true
    }

    compile ('com.m.c:APL:1.0') {
        changing=true
    }

    compile ('c.m.c:C:1.0') {
        changing=true
    }

    debugCompile 'ch.acra:acra:4.5.0'

    compile files('libs-gradle/aM.jar')
    compile files('libs-gradle/android-logging-log4j-m-1.0.3.jar')
    compile files('libs-gradle/ce.jar')
    compile 'com.google.android.gms:play-services-analytics:8.4.0'

    apt 'com.squareup.dagger:dagger-compiler:1.2.2'

}

}

apply plugin: 'com.google.gms.google-services'
2 Answers
Related