我一直在尝试将项目导入 Android Studio,这就是我遇到的问题, Stack Overflow 上有一个类似的问题,但它没有为我的特定错误提供解决方案。
这是我的错误日志:
C:\<some location>\build.gradle
Error:(24, 1) A problem occurred evaluating root project '<project name>'.
> Could not find method android() for arguments [build_4fli1jm76ubcnxesnhqnhie47$_run_closure3@6e71db85] on root project '<project name>'.
Information:BUILD FAILED
Gradle 同步消息是:
Error:(24, 0) Gradle DSL method not found: ‘android()’ 可能的原因:
项目“PoojaPeople”可能正在使用不包含该方法的 Gradle 版本。摇篮设置 构建文件可能缺少 Gradle 插件。应用 Gradle 插件
我不太确定这个方法 android()
里。如果它是位于应用程序的 build.gradle
文件中的那个,我仍然不知道从这里去哪里。任何帮助表示赞赏。
我的 build.gradle
是
buildscript {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android {
compileSdkVersion 17
buildToolsVersion '23.0.0'
}
dependencies {
compile files('app/libs/junit-4.12-JavaDoc.jar')
}
apply plugin: 'maven'
原文由 user1528506 发布,翻译遵循 CC BY-SA 4.0 许可协议
出现此错误是因为编译器在您的项目中找不到“my-upload-key.keystore”文件
生成文件后,您需要将其粘贴到项目的 andorid/app 文件夹中
这对我有用!