我已将 Android Studio 项目导入到 Android Studio 中,但出现错误:
Error:(1, 0) Plugin with id 'com.android.application' not found.
导入时似乎未创建项目的 Build.gradle 文件和 settings.gradle 文件
这是日志文件:
2017-01-05 15:07:25,745 [ 381987] INFO - ls.idea.gradle.GradleSyncState - Sync with Gradle for project 'app' failed: Plugin with id 'com.android.application' not found.
Consult IDE log for more details (Help | Show Log)
2017-01-05 15:07:25,755 [ 381997] WARN - roid.tools.ndk.GradleWorkspace - NDK support for project 'app' is disabled because the project doesn't contain any valid native configurations.
2017-01-05 15:07:25,795 [ 382037] INFO - #com.jetbrains.cidr.lang - Clearing symbols finished in 0 s.
2017-01-05 15:07:25,797 [ 382039] INFO - #com.jetbrains.cidr.lang - Loading symbols finished in 0 s.
2017-01-05 15:07:25,798 [ 382040] INFO - #com.jetbrains.cidr.lang - Building symbols finished in 0 s.
2017-01-05 15:07:25,799 [ 382041] INFO - #com.jetbrains.cidr.lang - Saving symbols finished in 0 s.
最佳答案
在包含 app
文件夹的文件夹中创建名为 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.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
所以结构是:
Project Name
- app
- src
- build
- build.gradle
- build
- gradle
- build.gradle (add this file)
关于java - 错误 :(1, 0) 未找到 ID 为 'com.android.application' 的插件 - 没有 build.gradle 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41488653/