[英]Error running react-native run-android: Unexpected Token in build.gradle
What went wrong: Could not compile build file '/Users/nathanael/Code/highst/mobile/android/build.gradle'.
出了什么问题:无法编译构建文件“/Users/nathanael/Code/highst/mobile/android/build.gradle”。
startup failed: build file '/../../android/build.gradle': 6: unexpected token: << @ line 6, column 1.
启动失败:构建文件“/../../android/build.gradle”:6:意外标记:<<@第 6 行,第 1 列。
<<<<<<< ours ^ 1 error
Sorry in advance, I'm a Gradle noob.提前抱歉,我是 Gradle 菜鸟。 I'm having this issue whenever I run react-native run-android
每当我运行 react-native run-android 时,我都会遇到这个问题
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
<<<<<<< ours
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.1.2'
classpath 'io.fabric.tools:gradle:1.+'
=======
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
>>>>>>> theirs
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
<<<<<<< ours
url 'https://maven.google.com'
}
}
}
=======
url 'https://maven.google.com/'
name 'Google'
}
}
}
ext {
buildToolsVersion = "26.0.3"
minSdkVersion = 16
compileSdkVersion = 26
targetSdkVersion = 26
supportLibVersion = "26.1.0"
}
>>>>>>> theirs
it is saying that <<<<< is not recognizable syntax by gradle.据说 <<<<< 是 gradle 无法识别的语法。 your project has git merge conflict you should either accept theirs or ours and delete
<<<<<
parts您的项目存在 git 合并冲突,您应该接受他们的或我们的并删除
<<<<<
部分
Either you should fetch fresh code from repo or delete "theirs" section and keep "ours" section as a suggestion.您应该从 repo 中获取新代码或删除“他们的”部分并保留“我们的”部分作为建议。
However seeing both the sections, from my experience: ext variables and class dependencies from theirs
should move to project level build.gradle file.但是,根据我的经验,看到这两个部分:来自
theirs
ext 变量和类依赖项应该移动到项目级别的 build.gradle 文件。
Clearly, "ours" section is from '<<<<<' till '=====' and 'theirs' section is from '=====' till '>>>>>'.
显然,“我们的”部分是从 '<<<<<' 到 '=====' 而 'theirs' 部分是从 '=====' 到 '>>>>>'。
Please see:请参见:
Learn GIT with BitBucket 通过 BitBucket 学习 GIT
How to resolve merge conflicts in Git如何解决 Git 中的合并冲突
Resolving a merge conflict using the command line 使用命令行解决合并冲突
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.