【发布时间】:2016-09-21 04:23:26
【问题描述】:
我刚刚安装了 Android 和运行 android 开发所需的所有相关工具。不幸的是,在 Gradle 同步的初始构建中,事件日志会打印出一条错误消息
错误信息(事件日志):
Gradle 同步失败:未找到 ID 为“com.android.applications”的插件。有关详细信息,请参阅 IDE 日志
这是当前项目(build.gradle)我的应用程序配置:
// 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.1.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
}
以及当前的Module(build.gradle)配置:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.user.myapplication"
minSdkVersion 9
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
}
【问题讨论】:
-
我阅读了整个解决方案,但它无法正常工作@W4R10CK
-
当你没有
gradle库时,一般会出现这种情况,请尝试将其与googleplay库一起添加。 -
将此添加到以下文件的依赖项中。
compile fileTree(include: ['*.jar'], dir: 'libs')testCompile 'junit:junit:4.12' -
嗯,是的,我尝试了 nitinsingh 尝试删除 gradle 目录并让 android 重新创建适当的 gradle,我发现您提到的相同依赖项出现在一个具有额外附加依赖项的新模块中,例如 compile 和 testCompile @W4R10CK
标签: java android android-gradle-plugin mobile-application android-sdk-tools