我知道关于这些问题:
https://dev59.com/BlcO5IYBdhLWcg3w5lUM
https://dev59.com/Hqbja4cB1Zd3GeqPfWPi
https://dev59.com/5VYN5IYBdhLWcg3wbnpj
我已经阅读了这些文档:
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html
https://developer.android.com/about/versions/oreo/android-8.0-migration.html#ptb
所以我发布了这个问题,相信它不是重复的。
我安装了Android Studio 3.4.1。我之前没有安装过任何版本,然后我开始了一个新项目。
Gradle文件中的所有设置都是由Android Studio自动设置的,并且我已经检查了它们。
我已经尝试过:
- 使Android Studio无效并重新启动 - https://dev59.com/5VYN5IYBdhLWcg3wbnpj-project - https://dev59.com/BlcO5IYBdhLWcg3w5lUM
以下是文件内容:
build.gradle (Module:app)
顶层 build.gradle
我在代码库中使用
无法解决依赖项':app@releaseUnitTest/compileClasspath':无法解决androidx.constraintlayout:constraintlayout:1.1.3。
ERROR: 无法解决依赖项':app@releaseUnitTest/compileClasspath':无法解决androidx.versionedparcelable:versionedparcelable:1.0.0。
ERROR: 无法解决依赖项':app@releaseUnitTest/compileClasspath':无法解决androidx.lifecycle:lifecycle-runtime:2.0.0。
ERROR: 无法解决依赖项':app@releaseUnitTest/compileClasspath':无法解决androidx.legacy:legacy-support-core-ui:1.0.0。
ERROR: 无法解决依赖项':app@releaseUnitTest/compileClasspath':无法解决androidx.vectordrawable:vectordrawable-animated:1.0.0。
ERROR: 无法解决依赖项':app@releaseUnitTest/compileClasspath':无法解决androidx.fragment:fragment:1.0.0。
我也取消了gradle的离线检查框,并使用默认设置。
为什么当我在AS 3.4.1中创建一个新项目并设置了所有必要的设置时,我还会遇到这个错误?
https://dev59.com/BlcO5IYBdhLWcg3w5lUM
https://dev59.com/Hqbja4cB1Zd3GeqPfWPi
https://dev59.com/5VYN5IYBdhLWcg3wbnpj
我已经阅读了这些文档:
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html
https://developer.android.com/about/versions/oreo/android-8.0-migration.html#ptb
所以我发布了这个问题,相信它不是重复的。
我安装了Android Studio 3.4.1。我之前没有安装过任何版本,然后我开始了一个新项目。
Gradle文件中的所有设置都是由Android Studio自动设置的,并且我已经检查了它们。
我已经尝试过:
- 使Android Studio无效并重新启动 - https://dev59.com/5VYN5IYBdhLWcg3wbnpj-project - https://dev59.com/BlcO5IYBdhLWcg3w5lUM
以下是文件内容:
build.gradle (Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 28
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 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
顶层 build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {url 'https://maven.google.com/'}
maven { url "https://jitpack.io" }
maven { url 'https://dl.bintray.com/guardian/android' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle-wrapper.properties
#Mon Jun 10 17:40:01 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
我在代码库中使用
google()
,就像这里明确说明的那样:
// If you're using a version of Gradle lower than 4.1, you must instead use:
// maven {
// url 'https://maven.google.com'
// }
我的gradle版本是4.1,所以我不需要上面的代码。但是我仍然遇到了其他人一直在询问的这个错误:无法解决依赖项':app@releaseUnitTest/compileClasspath':无法解决androidx.constraintlayout:constraintlayout:1.1.3。
ERROR: 无法解决依赖项':app@releaseUnitTest/compileClasspath':无法解决androidx.versionedparcelable:versionedparcelable:1.0.0。
ERROR: 无法解决依赖项':app@releaseUnitTest/compileClasspath':无法解决androidx.lifecycle:lifecycle-runtime:2.0.0。
ERROR: 无法解决依赖项':app@releaseUnitTest/compileClasspath':无法解决androidx.legacy:legacy-support-core-ui:1.0.0。
ERROR: 无法解决依赖项':app@releaseUnitTest/compileClasspath':无法解决androidx.vectordrawable:vectordrawable-animated:1.0.0。
ERROR: 无法解决依赖项':app@releaseUnitTest/compileClasspath':无法解决androidx.fragment:fragment:1.0.0。
我也取消了gradle的离线检查框,并使用默认设置。
为什么当我在AS 3.4.1中创建一个新项目并设置了所有必要的设置时,我还会遇到这个错误?