android-studio - 尝试在 Android Studio 3.5.3 中创建新项目时出现很多错误
问题描述
我想使用 Kotlin 在 Android Studio 3.5.3 中创建一个项目,但是我遇到了很多错误。
第一个错误是:
Could not find androidx.appcompat:appcompat:1.1.0.
Required by:
project :app
经过大量搜索后,我将 maven 添加到存储库:
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
}
现在我收到这些错误:
ERROR: Failed to resolve: androidx.core:core-ktx:1.2.0
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: constraintlayout-solver
Affected Modules: app
ERROR: Failed to resolve: androidx.test.espresso:espresso-core:3.2.0
Show in Project Structure dialog
Affected Modules: app
我不知道我应该怎么做才能消除这些错误。我尝试了很多方法,但我无法解决这些错误。
这是我的build.gradle
文件:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 17
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(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.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'
}
解决方案
推荐阅读
- html - HTML/CSS - 如何在此特定设置中将(输入)单选按钮移动到左侧?
- django - 我可以将 django orm 与未使用 django 设置的数据库一起使用吗
- django - 如何在测试运行器之外的空数据库上运行 django 测试?
- arrays - “array[x][y]”总是用指针算术计算吗?
- google-chrome-extension - 您如何将 Chrome 扩展程序国际化为粤语(香港)?
- git - 如何在git中默认对不同的文件类型使用不同的diff命令
- kubernetes - From a container that is part of a DaemonSet, how can I look up the labels on "the node on which I am running"?
- firebase - 在 Flutter、Provider 和 Firestore 中使用文档引用类型
- sql - SSIS - 每批次的行数少于设置
- django - Django 设置 request.GET,即为 GET 设置 url args 服务器端