我在Android Studio中进行Gradle sync 时出现了这个错误,Android Studio 出错提示是 Gradle sync
failed: A problem occurred configuring project ‘:app’,而错误日志的最后几行 是这样子的
2018-10-30 21:05:30,041 [thread 106] WARN - ect.sync.idea.ProjectSetUpTask - A
problem occurred configuring project ':app'. 2018-10-30 21:05:30,041 [thread
106] INFO - e.project.sync.GradleSyncState - Gradle sync failed: A problem
occurred configuring project ':app'. Consult IDE log for more details (Help |
Show Log) (379 ms) 2018-10-30 21:05:30,044 [e-1136-b06] INFO -
idea.project.IndexingSuspender - Consuming IndexingSuspender deactivation
event: SYNC_FINISHED 2018-10-30 21:05:30,044 [e-1136-b06] INFO -
idea.project.IndexingSuspender - Finishing batch update for project: Project
'D:\Projects\AndroidApplication' AndroidApplication 2018-10-30 21:05:30,113
[thread 107] INFO - #com.jetbrains.cidr.lang - Clearing symbols finished in
0.022 s. 2018-10-30 21:05:30,113 [thread 107] INFO - #com.jetbrains.cidr.lang -
Building symbols in FAST mode, 0 source files from total 0 project files
2018-10-30 21:05:30,114 [thread 107] INFO - #com.jetbrains.cidr.lang - Loading
symbols finished in 0.000 s. 2018-10-30 21:05:30,114 [thread 107] INFO -
#com.jetbrains.cidr.lang - Loading Header Maps finished in 0.000 s. 2018-10-30
21:05:30,114 [thread 107] INFO - #com.jetbrains.cidr.lang - Loading Module Maps
finished in 0.000 s. 2018-10-30 21:05:30,115 [thread 107] INFO -
#com.jetbrains.cidr.lang - Saving Module Maps finished in 0.001 s. 2018-10-30
21:05:30,115 [thread 107] INFO - #com.jetbrains.cidr.lang - Loaded 0 tables for
0 files (0 project files) 2018-10-30 21:05:30,115 [thread 107] INFO -
#com.jetbrains.cidr.lang - Building symbols for 0 source files 2018-10-30
21:05:30,118 [thread 107] INFO - #com.jetbrains.cidr.lang - Building symbols
for 0 unused headers 2018-10-30 21:05:30,119 [thread 107] INFO -
#com.jetbrains.cidr.lang - Building symbols finished in 0.004 s. 2018-10-30
21:05:30,120 [thread 107] INFO - #com.jetbrains.cidr.lang - Saving modified
symbols for 0 files (0 tables of total 0) 2018-10-30 21:05:30,120 [thread 107]
INFO - #com.jetbrains.cidr.lang - Saving symbols finished in 0.000 s.
2018-10-30 21:05:41,361 [e-1136-b06] INFO - idea.project.IndexingSuspender -
Consuming IndexingSuspender activation event: SYNC_TASK_CREATED 2018-10-30
21:05:41,375 [e-1136-b06] INFO - e.project.sync.GradleSyncState - Started sync
with Gradle for project 'AndroidApplication'. 2018-10-30 21:05:41,377
[e-1136-b06] INFO - idea.project.IndexingSuspender - Consuming
IndexingSuspender activation event: SYNC_STARTED 2018-10-30 21:05:41,377
[e-1136-b06] INFO - idea.project.IndexingSuspender - Starting batch update for
project: Project 'D:\Projects\AndroidApplication' AndroidApplication 2018-10-30
21:05:41,388 [thread 107] INFO - s.plugins.gradle.GradleManager - Instructing
gradle to use java from E:/AndroidStudio/jre 2018-10-30 21:05:41,391 [thread
107] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java
from E:/AndroidStudio/jre 2018-10-30 21:05:41,398 [thread 107] INFO -
xecution.GradleExecutionHelper - Passing command-line args to Gradle Tooling
API: -Didea.version=3.2 -Djava.awt.headless=true
-Pandroid.injected.build.model.only=true
-Pandroid.injected.build.model.only.advanced=true
-Pandroid.injected.invoked.from.ide=true
-Pandroid.injected.build.model.only.versioned=3
-Pandroid.injected.studio.version=3.2.0.26 -Pandroid.builder.sdkDownload=false
--init-script C:\Users\xxxx\AppData\Local\Temp\ijinit.gradle 2018-10-30
21:08:38,848 [e-1136-b06] INFO - ide.actions.ShowFilePathAction - Exit code 1

在网上找了一圈之后,也没有解决问题,最后我将目光放到了这个’:app’上,注意到在项目里有一个叫settings.gradle的文件,打开之后其内容为include
‘:app’,我抱着死马当活马医的态度在这个app前面加上了一个英文句点,没想到之后居然sync成功了,真是喜极而泣!

(小声比比:Android Studio真是我用过的最烂的一个IDE,其Android SDK配置之麻烦,下载文件之艰难,编译错误之丰富,实为罕见)