What should I do to how to fix android gradle error? - android

I am getting an error while starting the application in android studio.
the error i got;
AGPBI: {"kind":"error","text":"java.lang.IllegalArgumentException","sources":[{}],"tool":"D8"}
Task :app:desugarDebugFileDependencies FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:desugarDebugFileDependencies'.
A failure occurred while executing com.android.build.gradle.internal.tasks.DexFileDependenciesTask$DexFileDependenciesWorkerAction
Error while dexing.
Build Gradle app;
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id("androidx.navigation.safeargs")
//id 'kotlin-android-extensions'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.maden.kuryeapp_v2"
minSdk 23
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
sourceSets {
main.jniLibs.srcDirs = ['libs']
test.jniLibs.srcDirs = ['libs']
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
dataBinding {
enabled = true
}
buildFeatures {
viewBinding = true
}
buildFeatures {
dataBinding true
}
productFlavors { }
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//Fragment
def nav_version = "2.3.5"
implementation("androidx.navigation:navigation-fragment-ktx:$nav_version")
implementation("androidx.navigation:navigation-ui-ktx:$nav_version")
//Picasso & Glide
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
//Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3")
implementation("androidx.core:core-ktx:1.6.0")
//Others
implementation "de.hdodenhof:circleimageview:3.1.0"
implementation 'com.daimajia.swipelayout:library:1.2.0#aar'
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'
implementation 'org.bouncycastle:bcpkix-jdk15on:1.69'
implementation("com.google.guava:guava:30.1.1-android")
// RxJava
implementation 'io.reactivex.rxjava3:rxjava:3.0.0'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'
// Okhttp3 for the POST requests
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation 'org.apache.httpcomponents:httpcore:4.4.10'
implementation 'org.apache.httpcomponents:httpclient:4.5.6'
//Google
implementation 'com.google.android.gms:play-services-maps:17.0.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.akexorcist:googledirectionlibrary:1.0.4'
implementation 'com.google.firebase:firebase-messaging:22.0.0'
implementation 'com.google.android.gms:play-services-drive:17.0.0'
implementation 'com.google.android.gms:play-services-auth-base:17.1.4'
implementation 'com.google.firebase:firebase-appindexing:20.0.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-storage:20.0.0'
implementation 'com.google.android.gms:play-services-auth:19.2.0'
implementation 'com.auth0.android:jwtdecode:2.0.0'
implementation 'com.google.android.gms:play-services-mlkit-text-recognition:16.3.0'
implementation 'com.google.mlkit:language-id:16.1.1'
implementation 'net.gotev:speech:1.6.2'
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.multidex:multidex:2.0.1'
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: ['*mock*.jar'])
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation project(path: ':cropper')
implementation project(path: ':hbrecorder')
//implementation project(path: ':hbrecorder')
//tckk
implementation files('libs/ekds/tckkapi-operational-basic-2.13.1.jar')
implementation files('libs/ekds/tckkapi-interfaces-2.13.jar')
implementation files('libs/ekds/log4j-1.2.16.jar')
implementation fileTree(dir: 'libs/esya', include: ['*.jar'])
implementation files('libs/pdf/ADDLTV.jar')
implementation 'jp.wasabeef:blurry:2.1.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'org.jmrtd:jmrtd:0.7.18' // nfc kodu
implementation 'net.sf.scuba:scuba-sc-android:0.0.20'
implementation 'edu.ucar:jj2000:5.2'
implementation 'com.github.mhshams:jnbis:1.1.0'
//Camera
implementation 'androidx.camera:camera-camera2:1.1.0-alpha08'
}
Build Gradle module;
buildscript {
ext.kotlin_version = '1.5.20-RC'
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
def nav_version = "2.3.5"
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version")
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Related

Azure Active Directory's library get "Failed to resolve: com.microsoft.device.display:display-mask:0.3.0" error

Azure Active Directory's library get "Failed to resolve: com.microsoft.device.display:display-mask:0.3.0" error.
Failed to resolve: com.microsoft.device.display:display-mask:0.3.0
build.gradle(Module:app):
dependencies {
//MSAL
implementation 'com.microsoft.identity.client:msal:4.0.5'
implementation 'com.microsoft.identity:common:8.0.3'
implementation 'com.microsoft.device.display:display-mask:0.3.0'
implementation 'com.microsoft.graph:microsoft-graph:5.40.0'
implementation 'com.azure:azure-identity:1.7.0-beta.2'
}
build.gradle(Project)
buildscript {
repositories {
google()
mavenCentral()
mavenLocal()
maven {
url 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
}
maven {
name "vsts-maven-adal-android"
url "https://identitydivision.pkgs.visualstudio.com/_packaging/AndroidADAL/maven/v1"
credentials {
username System.getenv("ENV_VSTS_MVN_ANDROIDADAL_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_ANDROIDADAL_USERNAME") : project.findProperty("vstsUsername")
password System.getenv("ENV_VSTS_MVN_ANDROIDADAL_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_ANDROIDADAL_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
}
}
jcenter()
}
dependencies {
def nav_version = "2.5.2"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
}
}
After I changed gradle.build(module:app) as follow,
everything works now.
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'com.google.dagger.hilt.android'
id 'androidx.navigation.safeargs.kotlin'
}
android {
namespace
compileSdk 33
defaultConfig {
applicationId
minSdk 26
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug{
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
packagingOptions {
exclude 'META-INF/INDEX.LIST'
exclude 'META-INF/AL2.0'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/io.netty.versions.properties'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.exifinterface:exifinterface:1.3.5'
implementation 'androidx.annotation:annotation:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
def lifecycle_version = "2.6.0-alpha03"
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
// Lifecycles only (without ViewModel or LiveData)
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
//navigation
def nav_version = "2.5.3"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
// CameraX core library using the camera2 implementation
def camerax_version = "1.2.0-rc01"
// The following line is optional, as the core library is included indirectly by camera-camera2
implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}"
// If you want to additionally use the CameraX Lifecycle library
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
// If you want to additionally use the CameraX View class
implementation "androidx.camera:camera-view:${camerax_version}"
// If you want to additionally use the CameraX Extensions library
implementation "androidx.camera:camera-extensions:${camerax_version}"
//dagger hilt
implementation 'com.google.dagger:hilt-android:2.44'
kapt 'com.google.dagger:hilt-compiler:2.44'
//Coroutine
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
//OKHttp3
implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.9")
implementation('com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.9')
//Gson
implementation 'com.google.code.gson:gson:2.10'
//MSAL
implementation ("com.microsoft.identity.client:msal:4.0.5") { exclude group: 'com.microsoft.device.display'}
implementation 'com.microsoft.graph:microsoft-graph:5.40.0'
// Uncomment the line below if you are building an android application
implementation 'com.google.guava:guava:30.1.1-android'
// This dependency is only needed if you are using the TokenCrendentialAuthProvider
implementation 'com.azure:azure-identity:1.7.0-beta.2'
// To use CallbackToFutureAdapter
implementation "androidx.concurrent:concurrent-futures:1.1.0"
// Kotlin
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.6.4"
}
kapt {
correctErrorTypes true
}

H3lp m3 DSL element 'android.dataBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.dataBinding'

Could you help me to eliminate that DSL alert since as a result of this it does not allow me to link with firebase, I already tried the other groups and it does not work for me or maybe I do not know where to accommodate it
example
android {
buildFeatures {
dataBinding = true
// for view binding:
// viewBinding = true
}
}
I'm going crazy I don't know how to fix it
this is mi gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.app.womba"
minSdkVersion 27
targetSdkVersion 29
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
dataBinding {
enabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.9.1"
// Multidex
implementation 'androidx.multidex:multidex:2.0.1'
// View Model
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
//initUI
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
/// glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
/// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
/// okhttp3
implementation 'com.squareup.okhttp3:logging-interceptor:4.4.0'
/// CountryCodePicker
implementation 'com.github.inpossoft:CountryCodePickerProject:2.0.0'
//image picker
implementation 'com.github.maayyaannkk:ImagePicker:1.0.4'
implementation 'com.soundcloud.android:android-crop:1.0.1#aar'
// facebook
implementation 'com.facebook.android:facebook-login:5.12.1'
//validations
implementation "com.wajahatkarim3.easyvalidation:easyvalidation-core:1.0.1"
// crashlytics
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-core:17.2.1'
// push notification
implementation 'com.google.firebase:firebase-messaging:20.1.0'
// app permission
implementation 'com.afollestad:assent:2.3.1'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'de.hdodenhof:circleimageview:3.0.1'
implementation 'com.nex3z:flow-layout:1.3.0'
// Room
implementation 'androidx.room:room-runtime:2.2.3'
annotationProcessor 'androidx.room:room-compiler:2.2.3'
kapt 'androidx.room:room-compiler:2.2.3'
// socket
// implementation('io.socket:socket.io-client:0.8.3') {
// exclude group: 'org.json', module: 'json'
// }
implementation 'com.github.nkzawa:socket.io-client:0.6.0'
// double handel seekbar
implementation 'com.crystal:crystalrangeseekbar:1.1.3'
implementation 'com.wang.avi:library:2.1.3'
implementation('com.github.ganfra:material-spinner:2.0.0') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
//This is binah.ai sdk dependency
implementation project(path: ':bnhhrlib')
implementation 'com.jjoe64:graphview:4.2.2'
implementation files('libs/vidyoclient.jar')
implementation 'com.applandeo:material-calendar-view:1.4.0'
/**Stripe Payment Gateway*/
implementation 'com.stripe:stripe-android:12.1.0'
implementation 'com.karumi:dexter:4.2.0'
implementation 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:3.1.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
// app permission
implementation 'com.afollestad:assent:2.3.1'
}
apply plugin: 'com.google.gms.google-services'
In advance thanks for the help
You'll have to replace
dataBinding {
enabled = true
}
with the recommended process
buildFeatures {
dataBinding = true
}

How to resolve Duplicate Class error in Android

I am getting Duplicate class com.google.protobuf.AbstractMessageLite found in modules jetified-protobuf-javalite-3.11.0.jar (com.google.protobuf:protobuf-javalite:3.11.0) and jetified-protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1).
I have not seen an answer that clears up my issue. I appreciate any assistance.
apply plugin: 'com.android.application'
apply plugin: 'idea'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: "io.spring.dependency-management"
apply plugin: 'androidx.navigation.safeargs.kotlin'
android {
compileSdkVersion target_sdk_version
buildToolsVersion "29.0.2"
android.buildFeatures.dataBinding
defaultConfig {
applicationId "com.example.app"
minSdkVersion 29
targetSdkVersion target_sdk_version
multiDexEnabled true
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
packagingOptions {
exclude 'META-INF/main.kotlin_module'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable = true
}
debug {
minifyEnabled false
testCoverageEnabled false
}
}
dataBinding {
enabled = true
}
productFlavors {
}
lintOptions {
abortOnError false
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
sourceSets {
main {
main.java.srcDirs += 'src/main/kotlin'
}
}
compileOptions {
sourceCompatibility '1.8'
targetCompatibility '1.8'
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
lintOptions {
abortOnError false
disable 'GradleDependency', 'GoogleAppIndexingWarning'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'org.jetbrains.kotlin' && requested.name == 'kotlin-reflect') {
details.useVersion kotlin_version
}
}
}
}
buildscript {
ext {
gson_version = "2.8.2"
dagger_version = '2.25.2'
rx_version = '2.2.15'
glide_version = "4.7.1"
rx_firebase_version = "1.1.3"
support_version = '28.0.0'
rx_android_version = '2.1.1'
glide_version = '4.11.0'
target_sdk_version = 29
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
def nav_version = "2.3.0"
def lifecycle_version = "2.2.0"
def arch_version = "2.1.0"
def firebase_config = '19.2.0'
implementation ("com.google.firebase:firebase-config:$firebase_config",{
// protobuf-lite that firebase-config and Tink depends on.
exclude group: 'com.google.protobuf',module: 'protobuf-javalite'
exclude group: 'com.google.protobuf',module: 'protobuf-lite'
})
//Base SDK
implementation 'com.amazonaws:aws-android-sdk-appsync:3.0.2'
implementation 'com.amazonaws:aws-android-sdk-core:2.16.13'
//Dagger
implementation 'com.google.dagger:dagger-android:2.28.1'
kapt 'com.google.dagger:dagger-compiler:2.28.1'
kapt 'com.google.dagger:dagger-android-processor:2.28.1'
implementation 'com.google.dagger:dagger-android-support:2.28.1'
//Firebase/Amazon
implementation 'com.amazonaws:aws-android-sdk-iot:2.16.13'
implementation 'com.amazonaws:aws-android-sdk-mobile-client:2.16.13'
implementation "com.firebase:firebase-jobdispatcher:0.8.6"
implementation 'com.firebaseui:firebase-ui-auth:5.0.0'
implementation 'com.google.firebase:firebase-analytics:17.4.4'
implementation 'com.google.firebase:firebase-auth:19.3.2'
implementation 'com.google.firebase:firebase-core:17.4.4'
implementation 'com.google.firebase:firebase-database:19.3.1'
implementation 'com.google.firebase:firebase-firestore:21.5.0'
implementation 'com.google.firebase:firebase-storage:19.1.1'
///Glide
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
//JETBRAINS
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72'
//Kotlin
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.3.72'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.11.1'
//Lifecycle
// https://mvnrepository.com/artifact/android.arch.lifecycle/common-java8
implementation(group: 'androidx.lifecycle', name: 'lifecycle-common-java8', version: '2.2.0')
// Annotation processor
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0-alpha05'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0-alpha05'
implementation "androidx.navigation:navigation-dynamic-features-fragment:2.3.0"
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
// optional - ReactiveStreams support for LiveData
implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version"
// optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"
// optional - Test helpers for LiveData
testImplementation "androidx.arch.core:core-testing:$arch_version"
kapt 'androidx.databinding:databinding-compiler:4.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.8.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.8.0'
//Mini
implementation 'com.github.pabloogc:Mini:1.0.5'
kapt 'com.github.pabloogc.Mini:mini-processor:1.0.5'
annotationProcessor 'com.github.pabloogc.Mini:mini-processor:1.0.5'
// Required for Cognito
implementation('com.amazonaws:aws-android-sdk-cognitoauth:2.16.13#aar') { transitive = true }
//Rx
implementation 'io.reactivex.rxjava2:rxjava:2.2.19'
implementation "io.reactivex.rxjava2:rxandroid:$rx_android_version"
implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.5#aar'
//Support
implementation 'androidx.activity:activity-ktx:1.2.0-alpha06'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta8'
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.core:core:1.5.0-alpha01'
implementation 'androidx.fragment:fragment:1.3.0-alpha06'
implementation 'androidx.fragment:fragment-ktx:1.3.0-alpha06'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.google.android.material:material:1.3.0-alpha01'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.android.libraries.places:places:2.3.0'
implementation 'com.google.guava:guava:29.0-jre'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.karumi:dexter:6.2.1'
implementation 'com.pavelsikun:material-seekbar-preference:2.3.0'
implementation 'info.guardianproject.panic:panic:1.0'
implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
//Test
testImplementation 'junit:junit:4.13'
testImplementation 'com.natpryce:hamkrest:1.7.0.0'
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testImplementation 'org.junit.platform:junit-platform-runner:1.6.2'
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
androidTestImplementation 'androidx.test:runner:1.3.0-rc01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-rc01'
}
repositories {
google()
mavenCentral()
maven { url "http://dl.bintray.com/jetbrains/spek" }
apply plugin: 'com.google.gms.google-services'
//kotlin annotation processor
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
}
kotlin {
experimental {
coroutines "enable"
}
}
...
You need to add an exclusion on one of the imports so it only adds the package once.
Example:
// Now junit will not include hamcrest library. Therefore there will be no
//dependency conflict.
compile ('junit:junit:4.12'){
exclude group: 'org.hamcrest', module:'hamcrest-core'
}

Firebase not generating FCM Token

After reformatting my laptop and installed the latest version of android studio
the FCM token generation suddenly stopped.
I updated firebase messaging to 18.0.0
App-level Build.gradle file
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
vectorDrawables.useSupportLibrary = true
applicationId "com.myapp.app"
minSdkVersion 21
targetSdkVersion 26
versionCode 21
versionName "1.0.21"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}
dexOptions {
javaMaxHeapSize "Xg"
// jumboMode = true
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//noinspection GradleCompatible
implementation 'com.android.support:design:26.1.0'
//noinspection OutdatedLibrary
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.google.code.gson:gson:2.3'
implementation 'com.android.support:multidex:1.0.1'
implementation 'de.hdodenhof:circleimageview:1.2.1'
implementation 'com.github.gcacace:signature-pad:1.2.1'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.soundcloud.android:android-crop:1.0.1#aar'
implementation 'com.github.bumptech.glide:glide:3.5.2'
implementation 'com.google.android.gms:play-services-location:11.4.2'
implementation 'com.google.android.gms:play-services-maps:11.4.2'
implementation 'com.google.android.gms:play-services:11.4.2'
implementation 'com.google.android.gms:play-services-gcm:11.4.2'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
//implementation 'com.google.firebase:firebase-core:11.4.2'
//implementation 'com.google.firebase:firebase-messaging:11.4.2'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation 'com.intuit.sdp:sdp-android:1.0.5'
implementation 'com.shuhart.stepview:stepview:1.2.6'
implementation 'com.xw.repo:bubbleseekbar:3.6'
implementation 'com.github.andyxialm:ColorDialog:1.0.0'
implementation 'com.github.twinkle942910:monthyearpicker:0.0.1'
implementation 'com.daasuu:EasingInterpolator:1.0.0'
implementation 'com.agrawalsuneet.androidlibs:dotsloader:1.1'
implementation 'io.nlopez.smartlocation:library:3.3.3'
implementation 'com.bogdwellers:pinchtozoom:0.1'
implementation 'org.jsoup:jsoup:1.8.3'
implementation 'com.wdullaer:materialdatetimepicker:2.3.0'
implementation 'com.airbnb.android:lottie:2.5.0-rc1'
implementation 'com.razorpay:checkout:1.5.5'
implementation 'com.google.zxing:core:3.2.1'
}
apply plugin: 'com.google.gms.google-services'
Project Level Build.gradle file
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.1.0'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
all projects {
repositories {
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
maven { url "https://jitpack.io" }
//mavenCentral()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Getting Error
error: cannot access zzbck
class file for com.google.android.gms.internal.zzbck not found
tried to change this with
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services:16.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'

Duplicate jar entry - android

Am getting this warning during my build .
Warning: Exception while processing task java.io.IOException: Can't
write
[/Users/petrose/as_projects/MrPhone/app/build/intermediates/transforms/proguard/debug/0.jar]
(Can't read
[/Users/petrose/.gradle/caches/transforms-1/files-1.1/firebase-analytics-impl-16.2.4.aar/288ad7982e8f6024c8b5f0954f183721/jars/classes.jar(;;;;;;;**.class)]
(Duplicate jar entry
[com/google/android/gms/internal/measurement/eo.class]))
apply plugin: 'com.android.application'
//apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'org.greenrobot.greendao'
//apply plugin: 'io.fabric'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "....."
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables { useSupportLibrary = true }
multiDexEnabled true
resConfigs "en"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled true
useProguard true // obfuscate
shrinkResources true
}
debug {
minifyEnabled true
useProguard true // obfuscate
shrinkResources false
}
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
}
}
greendao {
schemaVersion 1
}
dependencies {
//extLib
implementation files('libs/YouTubeAndroidPlayerApi.jar')
//support Lib
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation "com.android.support:cardview-v7:28.0.0"
implementation "com.android.support:design:28.0.0"
implementation "com.android.support:support-vector-drawable:28.0.0"
implementation "com.android.support.constraint:constraint-layout:$rootProject.constraintLibraryVersion"
implementation "com.android.support:customtabs:28.0.0"
//Google API Client Library
implementation('com.google.apis:google-api-services-youtube:v3-rev195-1.23.0') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude group: 'com.google.guava'
}
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
exclude group: 'com.google.guava'
}
// implementation('com.google.apis:google-api-services-calendar:v3-rev309-1.23.0') {
// exclude group: 'org.apache.httpcomponents'
// exclude group: 'com.google.guava'
//
// }
// image
//implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion"
// implementation 'com.android.support:support-v4:27.1.1'
// implementation 'com.android.support.constraint:constraint-layout:1.1.0'
//annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.glideVersion"
implementation "com.squareup.picasso:picasso:$rootProject.picassoVersion"
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'
implementation 'com.commit451:PhotoView:1.2.4'
//Network
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation "com.squareup.retrofit2:retrofit:$rootProject.retorfitVersion"
implementation 'com.squareup.retrofit2:converter-scalars:2.2.0'
implementation "com.squareup.retrofit2:converter-gson:$rootProject.retorfitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retorfitVersion"
implementation 'org.jsoup:jsoup:1.10.3'
// parser
implementation "com.google.code.gson:gson:$rootProject.gsonVersion"
implementation 'com.fatboyindustrial.gson-jodatime-serialisers:gson-jodatime-serialisers:1.6.0'
//parceler
implementation 'org.parceler:parceler-api:1.1.12'
annotationProcessor 'org.parceler:parceler:1.1.12'
// database
implementation "org.greenrobot:greendao:$rootProject.greenDaoVersion"
debugImplementation "com.amitshekhar.android:debug-db:$rootProject.debugDBVersion"
//eventBus
implementation "org.greenrobot:eventbus:$rootProject.greenrobotVersion"
//DI
implementation "com.google.dagger:dagger-android:$rootProject.dagger2Version"
annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
implementation 'javax.inject:javax.inject:1'
compileOnly 'javax.annotation:jsr250-api:1.0'
// reactive
implementation "io.reactivex.rxjava2:rxjava:$rootProject.rxjava2Version"
implementation "com.github.miguelbcr:RxPaparazzo:$rootProject.rxRxPaparazzo"
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.1.1'
implementation "com.github.akarnokd:rxjava2-extensions:0.18.7"
//butterknife
implementation "com.jakewharton:butterknife:$rootProject.butterKnifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion"
// logger
implementation "com.jakewharton.timber:timber:$rootProject.timberVersion"
implementation "com.github.nisrulz:easydeviceinfo-base:$rootProject.easyDeviceInfoVersion"
implementation 'com.github.tslamic:dn3:3.0'
//Firebase crash analytics
//implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
// facebook sdk
// implementation "com.facebook.android:facebook-android-sdk:$rootProject.facebookAndroidSDK"
// implementation "com.facebook.android:audience-network-sdk:$rootProject.facebookNetworkSDK"
implementation 'com.facebook.android:facebook-login:4.28.0'
implementation 'com.facebook.android:audience-network-sdk:5.1.0-beta'
// google sdk
// implementation "com.google.android.gms:play-services-analytics:$rootProject.googleLibraryVersion"
implementation('com.google.android.gms:play-services-analytics:16.0.4') {
exclude group: 'com.google.guava'
}
implementation('com.google.android.gms:play-services-ads:17.0.0') {
exclude group: 'com.google.guava'
}
implementation('com.google.android.gms:play-services-auth:16.0.0') {
exclude group: 'com.google.guava'
}
implementation('com.google.android.gms:play-services-gcm:16.0.0') {
exclude group: 'com.google.guava'
}
// fireBase libraries
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-config:16.1.3'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.4'
implementation 'com.google.firebase:firebase-appindexing:17.1.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
//implementation 'com.google.firebase:firebase-perf:16.2.3'
//implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
//leak
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
//releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
//testLib
//testImplementation 'junit:junit:4.12'
// androidTestImplementation 'com.android.support.test:runner:1.0.1'
// androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '27.1.1'
}
}
}
}
//Top-level build file
buildscript {
repositories {
google()
jcenter()
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
classpath 'io.fabric.tools:gradle:1.27.0'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
While preparing for output jar (0.jar) at path {module}/build/intermediates/transforms/proguard/debug/0.jar, gradle copies all dependent library classes.jars and there dependent classes.jar to form a single intermediate jar. So when 2 different libraries are dependent on a single module, that single module is copied twice while leads to this error.
This can be solved by marking compileOnly to that single module in libraries which are using that module.

Categories

Resources