简体   繁体   中英

Android Studio project level build.gradle error

I am currently can`t sync my project because of project-level build.gradle.I thought it was corrupted and tried 1)Deleted caches(.AndroidStudio3.2/system/caches) 2)Invalidate Caches/Restart 3)Deleted the following files: .idea, .gradle, gradle, appname.iml, app.iml, 4)Deleted .gradle/wrapper/dists PS All other projects syncs. build.gradle code:

  <component name="libraryTable">
  <library name="Gradle: com.android.support.constraint:constraint-layout-1.1.3">
    <CLASSES>
      <root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/constraint-layout-1.1.3.aar/6e5d62e725623f0f1060b115dcb600fe/res" />
      <root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/constraint-layout-1.1.3.aar/6e5d62e725623f0f1060b115dcb600fe/jars/classes.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES />
  </library>
</component>

Error:startup failed: build file 'C:\\Users\\User\\AndroidStudioProjects\\Yol\\build.gradle': 1: unexpected token: < @ line 1, column 1. ^

1 error build.gradle screenshot

Thanks for response)

build.gradle files are written in Groovy, not XML, like you have there. I don't know how you ended up having that file as build.gradle, but the syntax is invalid, and that is what is causing the problem. Check https://developer.android.com/studio/build

单击顶部菜单中的“将项目与 Gradle 文件同步” - 这可能对您有所帮助

I am having the same problem. I am unable to sync my gradle cause it got replaced by some random lines. It would be great if someone could sent the syntax of the correct code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM