4

I am developing an app of barcode scanner.

URL : Barcode Scanner URL Here

My Android Studio version is 2.3.3

I always used compile in build.gradle (module:app) but i found this library suggested to use implementation in replace of compile.

I searched over internet compile is replaced by implementation in Android studio 3.0 but i have to use this library in Android studio 2.3.3.

example.

dependencies {
implementation 'com.budiyev.android:code-scanner:1.5.7'
}

when I put this in my gradle its showing error.

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.budiyev.android:code-scanner:1.5.7' // HERE
testCompile 'junit:junit:4.12'
}

Error is:

    Error:Failed to resolve: com.android.support:support-annotations:26.1.0
    Install Repository and sync project
    Show in Project Structure dialog

Please tell me how can i use this library in my android studio 2.3.3

Abhishek kumar
  • 4,347
  • 8
  • 29
  • 44

2 Answers2

5

You need to add Google's Maven repository in your top-level build.gradle .

      allprojects {
      repositories {
        google()

        // If you're using a version of Gradle lower than 4.1, you must instead use:
        // maven {
        //     url 'https://maven.google.com'
        // }
        // An alternative URL is 'https://dl.google.com/dl/android/maven2/'
    }
}
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
1

Add Maven repo to your project level gradle like this:

allprojects {
    repositories {

       maven {
            url "https://maven.google.com"
        }
    }
}

This is for Android Studio version 2.3.3 or Gradle version lower than 4.1

Kartik Shandilya
  • 3,796
  • 5
  • 24
  • 42