Unable to merge dex exception - android-studio

Iv'e suddenly got Unable to merge dex exception (My app worked perfectly until today). Iv'e tried clean and rebuild project with no success, also multiDexEnabled was true even before and still it doesn't work. my dependencies:
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.android.support:support-v4:26.1.0'
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'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
//noinspection UseOfBundledGooglePlayServices
implementation 'com.google.android.gms:play-services:11.8.0'
//noinspection GradleDynamicVersion
implementation 'com.google.maps.android:android-maps-utils:0.5+'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.android.gms:play-services-gcm:11.8.0'
implementation 'de.hdodenhof:circleimageview:2.1.0'
//noinspection GradleDynamicVersion
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
implementation 'com.squareup.picasso:picasso:2.5.2'

Related

Could not find method classpath() for arguments [androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3]

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'androidx.navigation.safeargs.kotlin' version '2.5.3' apply(false)
}
dependencies {
def nav_version='2.5.3'
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version")
// Feature module Support
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
// Testing Navigation
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
// classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version")
// Jetpack Compose Integration
implementation "androidx.navigation:navigation-compose:$nav_version"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
my build.gradle(app) files looks like this, I am getting the error while trying to sync.
was excepting to sync without errors.

Failed to transform artifact 'retrofit.jar' in androidx project

Androidx and Jetifier both are enabled in gradle.properties.
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
All the dependicies i'm using
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.squareup.retrofit2:retrofit:2.7.0'
implementation 'com.github.mukeshsolanki:country-picker-android:2.0.2'
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
}
minSDK is set to 21. This is the error build throws, i want my to use retrofit with androidx and minSDK 21, can some body help with this.
Error: Invoke-customs are only supported starting with Android O
(--min-api 26)

Manifest merger failed android studio

I have this in my build.gradle(module:app) :
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-
layout:1.1.3'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'
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.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
}
and when I try to sync it displays this:
ERROR: Manifest merger failed : Attribute application#appComponentFactory
value=(android.support.v4.app.CoreComponentFactory) from
[com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0]
AndroidManifest.xml:22:18-86 value=
(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to
<application> element at AndroidManifest.xml:9:5-32:19 to override.
what can cause this and how do I fix it?
(adding tools:replace="android:appComponentFactory" to the manifest doesn't work)
Your android-image-cropper library is using androidx, while you haven't migrated yet. It is highly recommended to migrate to using Androidx, since most of the libraries are doing the same and may not provide backward compatibility to the com.android.support variants.
If you cannot migrate in the short term, then you can revert to a lower version of the library. As per the changelog, they migrated to AndroidX in 2.8.0, so you should go back to 2.7.0.

Is there a no v7.28:0:0 of exitinterface library?

I'm getting an error of All com.android.support libraries must use the exact version specification.
here is where I'm getting the error "implementation 'com.android.support:appcompat-v7:28.0.0'"
I had com.android.support:exifinterface-v7:27.0.0 I don't know why it does not have a version 28. please help me T_T
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4: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.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-database:16.0.6'
implementation 'info.hoang8f:fbutton:1.0.5'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.firebaseui:firebase-ui-database:1.2.0'
implementation 'com.android.support:support-annotations:28.0.0'
}
I had com.android.support:exifinterface-v7:27.0.0 I don't know why it
does not have a version 28.
This is because exifinterface is belongs to com.android.support:exifinterface:28.0.0
so, use:
implementation "com.android.support:exifinterface:28.0.0"

App crash when implement google playservice

When I insert implementation of google play service ad to gradle, then My app got crashed.. and my dependencies looks like this:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
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-ads:17.1.1'
}
I got those and imported ...
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
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-ads:17.1.1'
implementation'com.android.support:animated-vector-drawable:27.1.1'
implementation'com.android.support:customtabs:27.1.1'
implementation'com.android.support:support-media-compat:27.1.1'
implementation'com.android.support:support-v4:27.1.1'
After implementing 'com.google.android.gms:play-services-ads:17.1.1', you must also insert the following into your AndroidManifest.xml.
For more information about App ID (a-app-pub-3940256099942544~3347511713) refer to https://developers.google.com/admob/android/quick-start.
<application
...
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/>
...
</application>

Resources