作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在按照教程在 android studio 中构建基于 android 的 QR 码扫描仪。但是,当我尝试在 build.gradle(app) 文件中实现 Zxing 时,出现错误显示:
意外的 token :com.journeyapps:zxing-android-embedded:3.4.0 @ 第 40 行,第 21 列。 实现'com.journeyapps:zxing-android-embedded:3.4.0'
这是 gradle.build 文件中的代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
'com.android.support:appcompat-v7:25.0.1'
testImplementation 'junit:junit:4.12'
//add this dependency
Implementation'com.journeyapps:zxing-android-embedded:3.4.0'
}
最佳答案
正如日志中提到的,问题出在这一行,
实现'com.journeyapps:zxing-android-embedded:3.4.0'
替换为
实现“com.journeyapps:zxing-android-embedded:3.4.0”
更改在于实现关键字,实现关键字和依赖项名称之间必须恰好有一个空格。
关于java - build.gradle 中出现意外 token : com. 旅程应用程序 :zxing-android-embedded:3. 4.0 @ 第 40 行,第 21 列错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58553978/
我是一名优秀的程序员,十分优秀!