错误 运行ning react-native 运行-android:build.gradle 中的意外令牌
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'.
startup failed: build file '/../../android/build.gradle': 6: unexpected token: << @ line 6, column 1.
<<<<<<< ours
^
1 error
提前抱歉,我是 Gradle 菜鸟。每当我 运行 react-native 运行-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
意思是 <<<<< 是 gradle 无法识别的语法。你的项目有 git 合并冲突你应该接受他们的或我们的并删除 <<<<<
部分
您应该从存储库中获取新代码,或者删除 "theirs" 部分并保留 "ours" 部分作为建议。
然而,根据我的经验,看到这两个部分:theirs
中的 ext 变量和 class 依赖项应该移动到项目级别 build.gradle 文件。
Clearly, "ours" section is from '<<<<<' till '=====' and 'theirs'
section is from '=====' till '>>>>>'.
请看:
How to resolve merge conflicts in Git
What went wrong: Could not compile build file '/Users/nathanael/Code/highst/mobile/android/build.gradle'.
startup failed: build file '/../../android/build.gradle': 6: unexpected token: << @ line 6, column 1.
<<<<<<< ours ^ 1 error
提前抱歉,我是 Gradle 菜鸟。每当我 运行 react-native 运行-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
意思是 <<<<< 是 gradle 无法识别的语法。你的项目有 git 合并冲突你应该接受他们的或我们的并删除 <<<<<
部分
您应该从存储库中获取新代码,或者删除 "theirs" 部分并保留 "ours" 部分作为建议。
然而,根据我的经验,看到这两个部分:theirs
中的 ext 变量和 class 依赖项应该移动到项目级别 build.gradle 文件。
Clearly, "ours" section is from '<<<<<' till '=====' and 'theirs' section is from '=====' till '>>>>>'.
请看:
How to resolve merge conflicts in Git