In a week, I struggled with some errors on Android Studio.
I want add Zxing Library dependencies in my project. But everytime I add the dependencies. I got this error
"Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve..."
I did remove "compile" with "implementation" on every dependencies that I'm looking for.
FYI: I've succeeded add Volley Library. No error appear.
This is my TOP build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my APP build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "id.plevia.projectx.app"
minSdkVersion 18
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation project(':feature')
implementation project(':base')
implementation('com.android.volley:volley:1.1.1')
}
This is my BASE build.gradle
apply plugin: 'com.android.feature'
android {
compileSdkVersion 28
baseFeature true
defaultConfig {
minSdkVersion 18
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
api 'com.android.support:appcompat-v7:28.0.0-rc02'
api 'com.android.support.constraint:constraint-layout:1.1.3'
application project(':app')
feature project(':feature')
implementation('com.android.volley:volley:1.1.1')
}
This is my FEATURE build.gradle
apply plugin: 'com.android.feature'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 18
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':base')
implementation('com.android.volley:volley:1.1.1')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
All the build.gradle script above without Zxing dependency.
All I want to do is to make Barcode Scanner without pressing a button on every scan
Thank you.
As @Arbaz.in answer in comment section. The answer of my problems is Uncheck Offline work option
File->Other Settings->Default Settings->Build, Execution, Deployment->Build Tools->Gradle->Uncheck Offline work option