膨胀类android.support.constraint.ConstraintLayout时出错。仅发布

膨胀类android.support.constraint.ConstraintLayout时出错。仅发布,android,Android,我已经开发了一个项目两个月,它在调试模式下工作。 今天我创建了一个版本apk,所有设备上都有一个错误: android.view.InflateException: Binary XML file line #0: Error inflating class android.support.constraint.ConstraintLayout Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/su

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

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
请帮忙

'com.android.support.constraint:constraint-layout:1.0.0'
试试这个

选择文件并选择作废缓存/重新启动

如果未工作,则将其更新为

compile 'com.android.support.constraint:constraint-layout:1.0.2'
试试这个

选择文件并选择作废缓存/重新启动

如果未工作,则将其更新为

compile 'com.android.support.constraint:constraint-layout:1.0.2'
背景

dexOptions {
    preDexLibraries false
}
解决了问题

设置

dexOptions {
    preDexLibraries false
}

解决了问题

我必须添加多索引支持:

build.gradle:

android {
    ...
    defaultConfig {
       ...
       multiDexEnabled true
    }
}
以及:


我必须添加多索引支持:

build.gradle:

android {
    ...
    defaultConfig {
       ...
       multiDexEnabled true
    }
}
以及:


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

android.support.constraint.ConstraintLayout

在xml布局中

进入:

androidx.constraintlayout.widget.constraintlayout


它解决了这个问题

对我来说,将现有类从非androidx项目复制到androidx项目中是一件好事。 我必须改变:

android.support.constraint.ConstraintLayout

在xml布局中

进入:

androidx.constraintlayout.widget.constraintlayout


它解决了这个问题

添加多索引并使缓存无效/重新启动添加多索引并使缓存无效/重新启动添加此依赖项并使重新启动无效添加此依赖项并使重新启动无效尝试在解决此问题后使缓存无效/重新启动。我需要将android:src更改为app:srcCompat。Tkstry还可以在解决该问题后使缓存无效/重新启动。我需要将android:src更改为app:srcCompat。TksI只是将它们插入文本比较工具,以确保。。。但它们都是一样的。说清楚。。。两个粗体字符串都是一样的。是的。。。我的错。。。诵读困难症困扰着我。第一个应该是“android.support.constraint.ConstraintLayout”,我只是将它们插入一个文本比较工具,以确保。。。但它们都是一样的。说清楚。。。两个粗体字符串都是一样的。是的。。。我的错。。。诵读困难症困扰着我。第一个“可能”应该是“android.support.constraint.ConstraintLayout”