有时候我安装我的Android应用程序时,会出现以下异常,但这并非总是可以重现。
java.lang.ClassCastException:android.support.v7.widget.ContentFrameLayout无法转换为android.support.v7.widget.ContentFrameLayout
我在我的Android应用程序上使用multidex,并阅读了关于三星设备具有multidex实现错误的此问题,但这在运行5.1的LG G3和运行6.0的HTC A9上发生。
有人知道为什么会随机发生这种情况,以及我该怎么做才能解决它吗?
编辑:我不能分享太多代码,因为这是我工作的公司的代码。
java.lang.ClassCastException:android.support.v7.widget.ContentFrameLayout无法转换为android.support.v7.widget.ContentFrameLayout
我在我的Android应用程序上使用multidex,并阅读了关于三星设备具有multidex实现错误的此问题,但这在运行5.1的LG G3和运行6.0的HTC A9上发生。
有人知道为什么会随机发生这种情况,以及我该怎么做才能解决它吗?
编辑:我不能分享太多代码,因为这是我工作的公司的代码。
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
应用插件:'com.android.application' 应用插件:'com.neenbedankt.android-apt'
构建脚本 { 仓库 { Maven中央() }
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
应用插件:'com.android.application' 应用插件:'com.neenbedankt.android-apt'
仓库 { 中央仓库() 仓库 { url 'https://repository-achartengine.forge.cloudbees.com/snapshot' } 仓库 { url 'libs-localrepository' } }
安卓 { 构建工具版本 "23.0.2" 编译SDK版本 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'
build.Gradle
文件。 - IntelliJ Amiya