android studio gradle的协助
这是我的第一篇帖子,但我需要一些帮助, 这是我的错误:android studio gradle的协助,android,gradle,Android,Gradle,这是我的第一篇帖子,但我需要一些帮助, 这是我的错误: error: package android.support.design.widget does not exist import android.support.design.widget.FloatingActionButton; 这是我的格雷德尔密码 apply plugin: 'com.android.application' android { compileSdkVersion 28 buildToolsV
error: package android.support.design.widget does not exist
import android.support.design.widget.FloatingActionButton;
这是我的格雷德尔密码
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.weatherviewerappeliasshahsamand"
minSdkVersion 23
targetSdkVersion 29
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(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
implementation 'com.google.android.material:material:1.2.0-alpha06'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
}
您的项目中既有支持库又有androidx库……我认为这一定是个问题。 您可以使用:
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
而不是:
implementation 'com.android.support:appcompat-v7:28.0.0'
您可以替换其他支持库代码并使用androidx库您已将一些依赖项迁移到androidx,但仍有一些依赖项似乎与android X不匹配。您必须将一些依赖项替换到最新版本: 替换 与 现在作为错误消息,请将小部件替换为androidx或通过
Refactor > Migrate to AndroidX > Migrate
你试过这个吗?我以为材料库没有下载。您对build.gradle进行了一些更改,然后按“Sync”可能会解决您的问题。
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
Refactor > Migrate to AndroidX > Migrate