简体   繁体   中英

Error unexpected token: com.journeyapps:zxing-android-embedded:3.4.0 @ line 40, column 21. in build.gradle

I was following a tutorial to build an android-base QR code scanner in android studio. However, when I try to implement Zxing in my build.gradle(app) file, I got error display:

unexpected token: com.journeyapps:zxing-android-embedded:3.4.0 @ line 40, column 21. Implementation'com.journeyapps:zxing-android-embedded:3.4.0'

Here is the code in gradle.build file:

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'

    }

As mentioned in the log the problem is at this line,

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

replace it with

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

The change is in the implementation keyword and there has to be exactly one space between implementation keyword and the name of the dependency.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM