Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/345.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 尝试复制和重建项目时出现Android Studio错误_Java_Android_Android Studio_Gradle - Fatal编程技术网

Java 尝试复制和重建项目时出现Android Studio错误

Java 尝试复制和重建项目时出现Android Studio错误,java,android,android-studio,gradle,Java,Android,Android Studio,Gradle,我正试图复制并构建一个不同的项目,这样我就可以针对Android开发教程中的一个实践问题更改一些内容。在这里,我遵循了关于如何复制项目的指南: a.t.的答案如下: 但经过多次尝试后,两人都失败了 在a.t.回答的第11步,当我去同步gradle文件时,我在别处更改了项目名称后,出现了以下两个错误: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException:

我正试图复制并构建一个不同的项目,这样我就可以针对Android开发教程中的一个实践问题更改一些内容。在这里,我遵循了关于如何复制项目的指南:

a.t.的答案如下:

但经过多次尝试后,两人都失败了

在a.t.回答的第11步,当我去同步gradle文件时,我在别处更改了项目名称后,出现了以下两个错误:

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
}


我是android studio的新手,也许这是一个简单的解决方案,但我还没有找到解决方案。谢谢你的帮助

好的,我理解你的问题,但不是完全理解。我想给你我的建议,当你把任何外部项目导入android studio时,你应该间接地去做。要解决任何类型的渐变或构建错误,您都可以做到,这非常简单

  • 使用android studio创建一个空项目并关闭它
  • 将项目中要导入到android studio的所有类和res文件夹复制到新创建的空项目中
  • 现在导入新项目而不是旧项目
  • 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'
    }