找不到以下 类:- android.support.constraint.ConstraintLayou
The following classes could not be found: - android.support.constraint.ConstraintLayou
由于几个问题,我不得不将我的 android 应用程序移动到 androidx。现在我遇到了问题,应用程序在 Desginer 中是 "greyed out"(见屏幕截图):
Screenshot
设计器中出现错误信息:
The following classes could not be found:
- android.support.constraint.ConstraintLayout ( Add constraint-layout library dependency to the project, Fix Build Path, Edit XML, Create Class)
我假设约束布局缺少 class,但事实并非如此。那是我的 build.gradle 文件:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-ads:19.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.android.support:design:28.0.0'
}
你有什么想法吗?
我已经尝试了互联网上的一切,制作应用程序,重建,与 gradle 文件同步,尝试不同版本的约束布局。
您似乎在尝试使用 android.support.constraint.ConstraintLayout
,同时向 androidx.constraintlayout:constraintlayout
添加依赖项。只需在 XML.
中使用后者
您似乎正尝试在同一个项目中使用 AndroidX 库和支持库。从菜单迁移到 AndroidX,它将替换包名称和依赖项。
您的项目正在从支持库而不是 AndroidX 添加小部件,这导致了此问题。
如果仍然出现错误,请替换列表中的旧软件包名称:https://developer.android.com/jetpack/androidx/migrate
尝试添加 material 设计依赖性
implementation 'com.google.android.material:material:1.1.0'
您的 appcompat 也应该是:
implementation 'androidx.appcompat:appcompat:1.1.0'
您正在使用 androidx containt 布局依赖项,但您的其他依赖项不兼容
由于几个问题,我不得不将我的 android 应用程序移动到 androidx。现在我遇到了问题,应用程序在 Desginer 中是 "greyed out"(见屏幕截图):
Screenshot
设计器中出现错误信息:
The following classes could not be found:
- android.support.constraint.ConstraintLayout ( Add constraint-layout library dependency to the project, Fix Build Path, Edit XML, Create Class)
我假设约束布局缺少 class,但事实并非如此。那是我的 build.gradle 文件:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-ads:19.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.android.support:design:28.0.0'
}
你有什么想法吗? 我已经尝试了互联网上的一切,制作应用程序,重建,与 gradle 文件同步,尝试不同版本的约束布局。
您似乎在尝试使用 android.support.constraint.ConstraintLayout
,同时向 androidx.constraintlayout:constraintlayout
添加依赖项。只需在 XML.
您似乎正尝试在同一个项目中使用 AndroidX 库和支持库。从菜单迁移到 AndroidX,它将替换包名称和依赖项。
您的项目正在从支持库而不是 AndroidX 添加小部件,这导致了此问题。
如果仍然出现错误,请替换列表中的旧软件包名称:https://developer.android.com/jetpack/androidx/migrate
尝试添加 material 设计依赖性
implementation 'com.google.android.material:material:1.1.0'
您的 appcompat 也应该是:
implementation 'androidx.appcompat:appcompat:1.1.0'
您正在使用 androidx containt 布局依赖项,但您的其他依赖项不兼容