我一直在尝试使用一些内置视图来运行一个简单的应用,但在Android Studio启动时,Gradle同步完成时几乎没有错误。我尝试过在互联网上看到的多种方法,但没有任何效果。我还从Android Studio文件中替换了gradle-2.14.1文件夹,通过下载zip文件并解压缩,但这也不起作用。
以下是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'
}
摇篮的包装器的属性:
#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
答案 0 :(得分:0)
在build.gradle
[app-level]中导入所有这些库,这些库列在错误列表中,并且还会更新你的android工作室 -
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'
}