我正在尝试复制并构建一个不同的项目,以便我可以针对 Android Dev 教程中的练习问题更改一些内容。我已经继续并遵循了有关如何在此处复制项目的指南:https://google-developer-training.github.io/android-developer-fundamentals-course-concepts-v2/appendix/appendix-utilities/appendix-utilities.html
和 a.t. 的答案在这里:Copy existing project with a new name in Android Studio
但经过多次尝试,我都失败了。
这是我收到错误的地方,在我去同步 gradle 文件时,在 at.t. 的回答的第 11 步,在我在其他地方更改了项目的名称后,它给了我这两个错误:
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'.
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.HelloToast3.tools.build:gradle:3.6.3.
这是我的项目
build.gradle
和我的模块应用程序 build.gradle
分别
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.HelloToast3.tools.build:gradle:3.6.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
}
apply plugin: 'com.HelloToast3.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.HelloToast3"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-HelloToast3-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'
}
我是android studio的新手,也许这是一个简单的修复,但我还找不到解决方案。感谢所有的帮助。
最佳答案
好的,我了解您的问题,但不完全了解。我想给你一个建议,当你将任何外部项目导入到 android studio 时,你应该间接地这样做。要解决任何类型的 gradle 或构建错误,您都可以做到,非常简单。
关于java - 尝试复制和重建项目时出现 Android Studio 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62253130/