【发布时间】:2014-12-17 19:27:01
【问题描述】:
我正在尝试在 Android Studio 中打开移植的 Android 应用程序,但在尝试同步 gradle 时不断收到以下错误:Error:(1, 0) Plugin with id 'android' not found.。我看过很多关于这个问题的帖子,但没有一个解决方案对我有帮助。这是我的 gradle 文件:
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:appcompat-v7:21.+'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.getbase:floatingactionbutton:1.3.0'
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
如果我做错了什么或者您需要更多信息,请告诉我。你能为我指出正确的方向吗?提前谢谢你。
编辑
我已经实施了该问题的答案并得到了以下结果。请重新考虑
Error:Gradle version 1.10 is required. Current version is 2.2.1. If using the gradle wrapper, try editing the distributionUrl in C:\Users\Gerhardt\git\captis\gradle\wrapper\gradle-wrapper.properties to gradle-1.10-all.zip.
Please fix the project's Gradle settings.
<a href="openGradleSettings">Gradle settings</a>
所以我指向了 2.2.1 版本并得到了这个:
Error:Could not find com.android.tools.build:gradle:2.2.1.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.jar
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.jar
Required by:
:captis:unspecified
我不知道该怎么办。请指教?
【问题讨论】:
-
@Scott,我也有同样的问题。谷歌正在强迫我们迁移。那没问题。 AS很酷。但是随后您将其标记为 dup.... 但是 dup 链接并不能解决问题。 Surly这是一个错误吗?斯科特有什么想法吗?非常感谢您的意见。
-
在 SO 上提出与之前提出的问题类似的问题时,最好详细说明。仅仅说“没有一个解决方案对我有帮助”通常不会帮助回答者理解为什么他们没有工作以及你的案例有何不同。
-
arggg...好点!现在感觉很傻。感谢您在下面的回答。
标签: android-studio