gpt4 book ai didi

android - Android Studio Gradle同步失败

转载 作者:行者123 更新时间:2023-12-03 05:57:05 25 4
gpt4 key购买 nike

我一直在尝试仅运行带有一些内置 View 的简单应用程序,但是在Android Studio启动时,Gradle同步完成时几乎没有错误。我尝试了多种在Internet上看到的方法,但是没有任何效果。我还通过下载zip文件并解压缩从Android Studio文件中替换了gradle-2.14.1文件夹,但是那也不起作用。

这是build.gradle(Project)的代码:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

build.gradle(app)的代码:
 apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.heenamehta.myapplication"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree( dir: 'libs' , include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
testCompile 'junit:junit:4.12'

}

Gradle-wrapper-properties:
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

我还附有在“消息”部分显示错误的图像。 Here is the image
另外有关额外信息,我正在使用:
Android Studio 2.2.3与
SDK API级别23和
生成工具25.0.2

最佳答案

build.gradle [应用程序级]中,导入所有这些库(列在错误列表中),并更新android studio-

    dependencies {
compile fileTree( dir: 'libs' , include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'

//Here - add all of those libraries dependencies
testCompile 'junit:junit:4.12'
}

关于android - Android Studio Gradle同步失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44258594/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com