如何替换实现以在Android Build.gradle中编译。 (Android Studio 2.3.3)
我正在开发一款条码扫描器应用程序。如何替换实现以在Android Build.gradle中编译。 (Android Studio 2.3.3)
我的Android Studio版本2.3.3是
我一直在使用的build.gradle编译(模块:应用程序),但我发现这个库建议使用实施在更换编译。
我搜索了网上编译由Android的工作室3.0 实施替换,但我在的Android 2.3.3工作室使用这个库。
示例。
dependencies {
implementation 'com.budiyev.android:code-scanner:1.5.7'
}
当我把这个在我的gradle这个错误显示。
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:Failed to resolve: com.android.support:support-annotations:26.1.0
Install Repository and sync project
Show in Project Structure dialog
请告诉我,我怎么能在我的Android工作室使用这个库2.3.3
您需要添加谷歌的Maven仓库在*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/'
}
}
到您的项目水平gradle这个添加的Maven回购这样的:
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
}
}
这是Android Studio版本2.3.3
或摇篮版本低于4.1
我加了但是也出现了相同的错误信息。 –
你的buildToolsVersion是什么? –
classpath'com.android.tools.build:gradle:2.3.3' –
遗憾地说,什么都不会发生同样的错误消息。我加入了build.gradle编译'com.budiyev.android:code-scanner:1.5.7',我替换了实现来编译。 –
@Abhishekkumar按照https://github.com/yuriy-budiyev/code-scanner,你应该使用'implementation'com.budiyev.android:code-scanner:1.5.7''。 –
@IntelliJAmiya权利 –