![](/img/trans.png)
[英]Error unexpected token: com.journeyapps:zxing-android-embedded:3.4.0 @ line 40, column 21. in build.gradle
[英]Unexpected token in \android\build.gradle line: 12 : unexpected token: }
我正在嘗試使用 react-native 運行一個項目。
我遵循了Viro 網站中給出的所有步驟。
當嘗試使用react-native run-android
構建項目時,我收到以下錯誤:
Could not compile build file '\ARDemo\android\build.gradle'.
啟動失敗:構建文件'\ARDemo\android\build.gradle':12:意外令牌:}@第12行,第1列。}^
1 個錯誤
嘗試:使用 --stacktrace 選項運行以獲取堆棧跟蹤。 使用 --info 或 --debug 選項運行以獲得更多日志 output。 運行 --scan 以獲得完整的見解。
在https://help.gradle.org獲得更多幫助
8 秒內構建失敗
錯誤安裝失敗
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
} // --> error is detected in this line
allprojects {
// Workaround for https://issuetracker.google.com/117900475
// Remove when upgrading to AGP 3.4 or higher
configurations.matching { it.name == '_internal_aapt2_binary' }.all { config ->
config.resolutionStrategy.eachDependency { details ->
details.useVersion("3.5.0-alpha03-5252756")
}
}
repositories {
mavenLocal()
maven {
url 'https://maven.google.com/'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
您在buildscript {
之后缺少repositories {
{
嘗試這個:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories { // --> this was missing
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
// Workaround for https://issuetracker.google.com/117900475
// Remove when upgrading to AGP 3.4 or higher
configurations.matching { it.name == '_internal_aapt2_binary' }.all { config ->
config.resolutionStrategy.eachDependency { details ->
details.useVersion("3.5.0-alpha03-5252756")
}
}
repositories {
mavenLocal()
maven {
url 'https://maven.google.com/'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.