Android Studio 3.5.3 不导入某些小部件
Android Studio 3.5.3 does not import some widget
Android Studio 不导入某些小部件。
我尝试了以下选项,但都失败了。
1.Invalidate缓存并重启
2.Clean 和重建项目
3.Exit AS,删除.iml文件和.deal文件夹,导入项目
4.Sync 文件系统
5.Sync 项目有 Gradle 个文件。
6.Uninstall AS 并使用相同版本重新安装。
以上都没有帮助,请有人帮助我。
应用程序 gradle 级别
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.viewvideo"
minSdkVersion 16
targetSdkVersion 29
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies
{
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.google.firebase:firebase-firestore:21.3.1'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-storage:19.1.0'
implementation 'androidx.multidex:multidex:2.0.0'
}
项目Gradle级别
buildscript{
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
更新
我认为,您的 Android SDK 有问题。删除并重新安装 Android SDK 将解决问题
首先尝试在 ViewActivity 中手动导入 ImageButton 以检查 class 库中是否可用
import android.widget.ImageButton;
然后添加
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
并删除
buildToolsVersion "29.0.2"
同步并重试...让我知道
Android Studio 不导入某些小部件。
我尝试了以下选项,但都失败了。
1.Invalidate缓存并重启
2.Clean 和重建项目
3.Exit AS,删除.iml文件和.deal文件夹,导入项目
4.Sync 文件系统
5.Sync 项目有 Gradle 个文件。
6.Uninstall AS 并使用相同版本重新安装。
以上都没有帮助,请有人帮助我。
应用程序 gradle 级别
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.viewvideo"
minSdkVersion 16
targetSdkVersion 29
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies
{
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.google.firebase:firebase-firestore:21.3.1'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-storage:19.1.0'
implementation 'androidx.multidex:multidex:2.0.0'
}
项目Gradle级别
buildscript{
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
更新
我认为,您的 Android SDK 有问题。删除并重新安装 Android SDK 将解决问题
首先尝试在 ViewActivity 中手动导入 ImageButton 以检查 class 库中是否可用
import android.widget.ImageButton;
然后添加
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
并删除
buildToolsVersion "29.0.2"
同步并重试...让我知道