android - 导入android支持库
问题描述
我对android完全陌生,我正在尝试一些东西。但是有一个我无法解决的问题。我正在尝试导入一些 android 支持库,即使通过将 google() 添加到我的 Gradle 构建并单击 Sync Now 似乎我做得正确,但出现错误。我什至使用项目结构管理器添加依赖项,它仍然显示为红色。这是我的 build.gradle 模块文件:
plugins {
id 'com.android.application'
}
allprojects {
repositories {
google()
}
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.avoidspleen.exossupspe"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
// Appears red from now
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
// End of red
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
我正在使用 JetBrains 工具箱来更新 Android Studio 版本 4.1.2。
解决方案
推荐阅读
- java - FirebaseInAppMessagingClickListener 不调用 android
- javascript - 如何将对象数组传递给 Query?
- python - 将元组从函数“导出”到全局变量
- typescript - 从组件获取数据
- azure - 端点 webhook url 上的事件网格订阅的 ARM 部署失败
- hdf5 - 如何将 HDF5 数据集作为 Snakemake 输入/输出?
- ios - 我希望打印的值太长,无法打印 firebase 中的所有值
- excel - 如何从工作表中读取值并检查它们是否存在于 .txt 文件中
- project-reactor - Reactor 项目中的 Fuseable 接口有什么用?
- javascript - 如何在 React 中调用注入到 ReactNative 的 WebView 中的 JavaScript 代码?