Dynamsoft Android SDK clashes with okhttp3 - android

I am working in a company project and there is a requirement to integrate Dynamsoft Android SDK for document scanning purpose. This problem is, when the sdk dependency is added to the current project, it get clashes with okhttp3 while giving this error on Build-console :
**Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Program type already present: okhttp3.Address
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.**
As it suggests in Developer console, okhttp3 has been excluded(actually tried in manifold ways) from Dynamsoft dependency yet problem remains.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
buildToolsVersion "28.0.2"
compileSdkVersion 28
defaultConfig {
applicationId "no.aspit.capture"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
dev {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'okhttp3/internal/publicsuffix/publicsuffixes.gz'
}
}
kotlin {
experimental {
coroutines 'enable'
}
}
androidExtensions {
experimental = true
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.cardview:cardview:1.0.0-rc02'
implementation 'androidx.core:core-ktx:1.0.0-rc02'
implementation "android.arch.work:work-runtime-ktx:1.0.0-alpha08"
implementation 'androidx.preference:preference:1.0.0-rc02'
implementation 'androidx.fragment:fragment-ktx:1.0.0-rc02'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-rc02'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.squareup.moshi:moshi-kotlin:1.6.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.4.0'
kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.6.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.github.ittianyu:BottomNavigationViewEx:1.2.4'
//noinspection GradleCompatible
implementation "com.android.support:design:26.1.0"
implementation 'com.squareup.picasso:picasso:2.71828'
//Joda time
implementation 'net.danlew:android.joda:2.9.9.4'
// Image Compression
implementation 'id.zelory:compressor:2.1.0'
//Stetho
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
//Dynumsoft
implementation ('com.dynamsoft:dynamsoftcamerasdk:2.0#aar'){
exclude group: 'com.squareup.okhttp3'
}
}
repositories {
maven {
url "http://download.dynamsoft.com/maven/dcs"
}

You can try to solve the conflicts as follows:
configurations.all {
all*.exclude group: 'com.squareup.okhttp3', module: 'okhttp'
all*.exclude group: 'com.squareup.okio', module: 'okio'
resolutionStrategy.force 'com.squareup.okhttp3:okhttp:3.10.0'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.cardview:cardview:1.0.0-rc02'
implementation 'androidx.core:core-ktx:1.0.0-rc02'
implementation "android.arch.work:work-runtime-ktx:1.0.0-alpha08"
implementation 'androidx.preference:preference:1.0.0-rc02'
implementation 'androidx.fragment:fragment-ktx:1.0.0-rc02'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-rc02'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.squareup.moshi:moshi-kotlin:1.6.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.4.0'
kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.6.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.github.ittianyu:BottomNavigationViewEx:1.2.4'
//noinspection GradleCompatible
implementation "com.android.support:design:26.1.0"
implementation 'com.squareup.picasso:picasso:2.71828'
//Joda time
implementation 'net.danlew:android.joda:2.9.9.4'
// Image Compression
implementation 'id.zelory:compressor:2.1.0'
//Stetho
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
//Dynumsoft
implementation ('com.dynamsoft:dynamsoftcamerasdk:2.0#aar')
}

Related

Libraries using reflection such as annotation processors need to be updated manually to add support for androidx

I have migrated to androidX by using android studio 3.4 and after migrating I'm facing every time this issue. Though I've tried excluding butterknife compilerAnnotation in gradle.properties but that shows WARNING: The option setting 'android.jetifier.blacklist=butterknife.*\.jar' is experimental and unsupported.
I've also updated to the latest butterknife dependency where JakeWharton himself mentioned the issue has been solved and it was jetifier issue. look at this workaround
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
In my build.gradle file
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
so I think this support library causes the issue. I've tried every solutions that comes in google first search result and couldn't solve it.
here is my build.gradle file
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.audacityit.selltec"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// Butterknife requires Java 8.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
//Support library
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//eventbus
implementation 'org.greenrobot:eventbus:3.1.1'
//butterknife
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
//parceler
implementation 'org.parceler:parceler-api:1.1.9'
annotationProcessor 'org.parceler:parceler:1.1.9'
//glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
//palette
implementation 'androidx.palette:palette:1.0.0'
//multidex
implementation 'androidx.multidex:multidex:2.0.1'
//utility
implementation 'com.iamsourav.sohoz:sohoz:1.0.0'
//circleimageview
implementation 'de.hdodenhof:circleimageview:3.0.0'
//recycler animator
implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
//eventbus
implementation 'org.greenrobot:eventbus:3.1.1'
//shimmer
implementation 'com.github.sharish:ShimmerRecyclerView:v1.2'
//AutoScrollViewPager
// implementation('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') {
// exclude module: 'support-v4'
// }
implementation 'cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2'
//Flowlayout
implementation 'com.hyman:flowlayout-lib:1.1.2'
//two way slider
implementation 'io.apptik.widget:multislider-holo:1.3'
implementation 'at.blogc:expandabletextview:1.0.5'
//shimmer
implementation 'com.github.sharish:ShimmerRecyclerView:v1.2'
//google analytics
implementation 'com.google.android.gms:play-services-analytics:16.0.8'
//validation
implementation 'com.mobsandgeeks:android-saripaar:2.0.3'
//permission dispathcher
implementation("com.github.hotchemi:permissionsdispatcher:3.1.0") {
// if you don't use android.app.Fragment you can exclude support for them
exclude module: "support-v13"
}
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:3.1.0"
//Image cropper
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
//implementation 'com.crystal:crystalrangeseekbar:1.1.1'
//testing
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0#aar') {
transitive = true
}
}

Error: Program type already present: com.google.firebase.analytics.FirebaseAnalytics$Event

The error persists when i try to build my code. I have already provided latest versions for all the implementations. Also i haven't used Analytics tool of firebase, but why is this error occurring ?
I have been updating the versions of the implementations one by one to mitigate several errors of such kinds.
my app/build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.ayushadarsh.odolog"
minSdkVersion 22
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'
}
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
//implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.1'
//noinspection UseOfBundledGooglePlayServices
implementation "com.google.android.gms:play-services:12.0.1"
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
implementation 'com.google.firebase:firebase-ml-vision:19.0.3'
}
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
This needs to be changed/updated to play-services-base:16.1.0 (which is not bundled):
//noinspection UseOfBundledGooglePlayServices
implementation "com.google.android.gms:play-services:12.0.1"
And remove this line; simply because painting the problem does not solve the problem:
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
Libraries com.android.support:appcompat-v7:28.0.0 & com.android.support:cardview-v7:28.0.0 are also added twice. and this one plugin belongs to the bottom of the build.gradle:
apply plugin: "com.google.gms.google-services"
... this fixes the build:
dependencies {
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:support-v4:28.0.0"
implementation "com.android.support:cardview-v7:28.0.0"
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation "com.android.support:exifinterface:28.0.0"
implementation "com.android.support:design:28.0.0"
implementation "com.android.support.constraint:constraint-layout:1.1.3"
implementation "com.google.firebase:firebase-core:16.0.8"
implementation "com.google.firebase:firebase-auth:16.2.1"
implementation "com.google.firebase:firebase-database:16.1.0"
implementation "com.google.firebase:firebase-ml-vision:19.0.3"
implementation ("com.google.android.gms:play-services-base:16.1.0") {
exclude group: "com.android.support", module: "support-v4"
}
implementation ("com.google.android.gms:play-services-auth:16.0.1") {
exclude group: "com.android.support", module: "support-v4"
}
implementation ("com.theartofdev.edmodo:android-image-cropper:2.6.0") {
exclude group: "com.android.support", module: " exifinterface"
}
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"
}
apply plugin: "com.google.gms.google-services"
Remove this
implementation 'com.google.android.gms:play-services:12.0.1'
change
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
to
apply plugin: 'com.google.gms.google-services'

solve error: cannot access Publisher in Android Studio?

I am getting this error while compilation of my code:
Can anyone help me how to solve this error or what might be causing this error?
Edit1: Gradle file of the project . And also the error log is attached with the question above.please check it.
import com.google.gms.googleservices.GoogleServicesPlugin
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.veblr.videomate"
minSdkVersion 21
targetSdkVersion 28
versionCode 16
versionName "1.0.0.8"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
aaptOptions.cruncherEnabled = true
aaptOptions.useNewCruncher = false
vectorDrawables.useSupportLibrary = true
resConfigs "en"
}
buildTypes {
debug {
jniDebuggable true
multiDexEnabled true
}
release {
minifyEnabled false
///shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
//Other parameters
debuggable false
jniDebuggable false
renderscriptDebuggable false
pseudoLocalesEnabled false
zipAlignEnabled true
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
ext {
roomVersion = '1.0.0'
archLifecycleVersion = '1.1.0'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/XXX'
exclude 'META-INF/license/LICENSE.base64.txt'
exclude 'META-INF/rxjava.properties'
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
dexOptions {
jumboMode true
preDexLibraries = false
javaMaxHeapSize "12g" //specify the heap size for the dex process
}
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven{ url "https://adcolony.bintray.com/AdColony"}
maven { url 'https://maven.fabric.io/public'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.adcolony:sdk:3.3.0'
implementation 'com.google.ads.mediation:adcolony:3.2.1.1'
implementation 'com.google.android.material:material:1.0.0'
implementation "com.google.firebase:firebase-measurement-connector-
impl:17.0.5"
//noinspection GradleCompatible
implementation 'com.google.ads.mediation:facebook:4.27.0.0'
implementation 'com.facebook.android:audience-network-sdk:4.27.0'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.danikula:videocache:2.7.0'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.0.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.firebaseui:firebase-ui-database:4.3.1'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'org.piwik.sdk:piwik-sdk:2.0.0'
implementation 'com.android.support:multidex:1.0.3'
debugImplementation 'com.amitshekhar.android:debug-db:1.0.0'
// Room components
implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
androidTestImplementation 'android.arch.persistence.room:compiler:1.1.1'
// Lifecycle components
implementation 'android.arch.lifecycle:extensions:1.1.1'
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
implementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation "android.arch.lifecycle:viewmodel:1.1.1"
implementation 'android.arch.navigation:navigation-fragment:1.0.0-rc02'
implementation 'android.arch.navigation:navigation-ui:1.0.0-rc02'
}
apply plugin: 'com.google.gms.google-services'
GoogleServicesPlugin.config.disableVersionCheck = true
apply plugin: 'digital.wup.android-maven-publish'
I think there is some problem with the java compiler and java sdk if so ,please let me know if that's the problem and how to solve it .
Make sure in your project gradle buildscript you use latest version:
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
And also try to update version of your libraries use latest version:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.adcolony:sdk:3.3.0'
implementation 'com.google.ads.mediation:adcolony:3.2.1.1'
implementation 'com.google.android.material:material:1.0.0'
implementation "com.google.firebase:firebase-measurement-connector-impl:17.0.5"
//noinspection GradleCompatible
implementation 'com.google.ads.mediation:facebook:4.27.0.0'
implementation 'com.facebook.android:audience-network-sdk:4.27.0'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.danikula:videocache:2.7.0'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.16'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.firebaseui:firebase-ui-database:4.3.1'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'org.piwik.sdk:piwik-sdk:2.0.0'
implementation 'com.android.support:multidex:1.0.3'
debugImplementation 'com.amitshekhar.android:debug-db:1.0.0'
// Room components
implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
androidTestImplementation 'android.arch.persistence.room:compiler:1.1.1'
// Lifecycle components
implementation 'android.arch.lifecycle:extensions:1.1.1'
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
implementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation "android.arch.lifecycle:viewmodel:1.1.1"
implementation 'android.arch.navigation:navigation-fragment:1.0.0'
implementation 'android.arch.navigation:navigation-ui:1.0.0'
}
Run it with --stacktrace or --info or --debug to see more log outputs information from the terminal for example: ./gradlew compileDebugJavaWithJavac --debug.
You wi be able to see more info on when and where it stopped the task and why it failed.
in my case the Publisher class was belong to the RxJava library which was missing from my project so adding these two lines in my app/gradle file fixed the problem:
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.x.x'
Try to update latest versions:
RxJava: io.reactivex.rxjava2:rxjava
RxAndroid: io.reactivex.rxjava2:rxandroid
Then, AndroidStudio -> File -> invalidate Cashes/Restart.
It helped me.
There is problem with 'com.google.firebase:firebase-core:16.0.8' library , when I upgraded it in app/gradle , it solved the problem for me.

Error Program type already present: com.google.common.util.concurrent.ListenableFuture

I'm need to use two guava classes:
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
But i'm getting this, when build\rebuild project:
Program type already present: com.google.common.util.concurrent.ListenableFuture
Message{kind=ERROR, text=Program type already present: com.google.common.util.concurrent.ListenableFuture, sources=[Unknown source file], tool name=Optional.of(D8)}
This is my build.gradle file:
also i'm tried to write exclude, but maybe i'm doing this wrong?
And i'm tried to delete crashlytics logs, tried to delete gms-services, but nothing helps
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
mavenCentral()
jcenter()
}
android {
useLibrary 'org.apache.http.legacy'
lintOptions {
checkReleaseBuilds false
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
compileSdkVersion 27
defaultConfig {
applicationId "com.jinga.updater"
minSdkVersion 26
targetSdkVersion 27
versionCode 16
versionName "2.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
def archLifecycleVersion = '1.1.1'
def room_version = "1.1.1"
def versions_work = "1.0.0-alpha09"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.novoda:merlin:1.1.7'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.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'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation group: 'com.google.guava', name: 'guava', version: '23.5-android'
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
// Room components
androidTestImplementation "android.arch.persistence.room:testing:$room_version"
// Lifecycle components
implementation "android.arch.lifecycle:extensions:$archLifecycleVersion"
annotationProcessor "android.arch.lifecycle:compiler:$archLifecycleVersion"
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-messaging:17.3.1'
implementation group: 'commons-io', name: 'commons-io', version: '2.5'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.yandex.android:mobmetricalib:3.2.2'
implementation 'com.github.nkzawa:socket.io-client:0.3.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:cardview-v7:27.1.1'
//circleImage
implementation 'com.orhanobut:dialogplus:1.11#aar'
implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
implementation 'com.liulishuo.okdownload:okdownload:1.0.4'
implementation "android.arch.work:work-runtime:$versions_work"
}
apply plugin: 'com.google.gms.google-services'
What i should to do to solve this issue, i see some examples on stack with work-manager, but they dont help me
I was having the same problem, and the cause: I was using this lib:
implementation "android.arch.persistence.room:guava:1.1.1"
I don't know why, it returned to me an error like yours, but try to remove this and find another solution
I found this little "pseudo" api useful:
https://mvnrepository.com/artifact/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava
I.e. adding
api 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
fixed my build problems in a elegant, though obscure way.

Failed in gradle synchronizing

As my gradle file on app level is as:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.developer.pkcaller"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-iid:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
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'
implementation files('libs/volley.jar')
implementation 'com.firebaseui:firebase-ui:2.1.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.hbb20:ccp:1.7.2'
implementation 'com.facebook.android:facebook-login:[4,5)'
implementation 'com.squareup.picasso:picasso:2.3.2'
implementation 'com.google.android.gms:play-services-analytics:16.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-plus:15.0.1'
//implementation 'com.google.android.gms:play-services:16.0.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.google.android.gms:play-services:12.0.1'
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
And I got error is as follows:
error: cannot access zzbgl class file for
com.google.android.gms.internal.zzbgl not found
Please help me solve this. I am stuck in this. Please help me regarding I will be highly grateful to you.

Categories

Resources