错误意外的令牌:com.wileapps:zxing安卓嵌入式:3.4.0@第40行,第21列.在build.gradl



我遵循一个教程在android studio中构建一个基于android的二维码扫描仪。然而,当我尝试在build.gradle(应用程序(文件中实现Zxing时,我得到了错误显示:

意外的令牌:com.wileapps:zxing安卓嵌入式:3.4.0@第40行,第21列。实现‘com.wealaps:zxing安卓嵌入式: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'
}

如日志中所述,问题出现在这一行,

Implementation'com.journeyapps:zxing-android-embedded:3.4.0'

用代替

implementation 'com.journeyapps:zxing-android-embedded:3.4.0'

更改发生在实现关键字中,并且实现关键字和依赖项名称之间必须只有一个空格。

最新更新