扩展类android.support.constraint.ConstraintLayout时出错。仅发布

时间:2017-09-08 12:15:51

标签: android

我一直在开发一个项目2个月,它在调试模式下工作。 今天我创建了一个版本apk,我在所有设备上都有错误:

     12300,"Z S.A.S.; Linked To: RED MUNDIAL INMOBILIARIA, 
S.A. DE C.V.; Linked To: FUNDACION PARA EL BIENESTAR Y EL PORVENIR; 
Linked To: C.I. METALURGIA EXTRACTIVA DE COLOMBIA S.A.S.;
Linked To: GRUPO MUNDO MARINO, S.A.; 
Linked To: C.I. DISERCOM S.A.S.; 
Linked To: C.I. OKCOFFEE COLOMBIA S.A.S.; 
Linked To: C.I. OKCOFFEE INTERNATIONAL S.A

请帮忙!

android.view.InflateException: Binary XML file line #0: Error inflating class android.support.constraint.ConstraintLayout
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/constraint/solver/widgets/ConstraintWidgetContainer;
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.constraint.solver.widgets.ConstraintWidgetContainer" on path: DexPathList[[zip file
Suppressed: java.lang.ClassNotFoundException: android.support.constraint.solver.widgets.ConstraintWidgetContainer
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

4 个答案:

答案 0 :(得分:1)

我必须添加multidex支持:

<强>的build.gradle:

android {
    ...
    defaultConfig {
       ...
       multiDexEnabled true
    }
}

dependencies {
    ...
    implementation 'com.android.support:multidex:1.0.3'
    ...
}

答案 1 :(得分:0)

试试这个

选择文件并选择无效缓存/重新启动

如果不起作用,则将其更新为

{{1}}

答案 2 :(得分:0)

设置

dexOptions {
    preDexLibraries false
}

解决了问题

答案 3 :(得分:0)

对我来说,它碰巧将现有类从非androidx项目复制到androidx项目中。 我必须更改:

androidx.constraintlayout.widget.ConstraintLayout

在xml布局中

进入:

androidx.constraintlayout.widget.ConstraintLayout

它解决了问题。