App crash when implement google playservice - android-studio

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>

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)

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"

Unable to merge dex exception

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'

Unable to resolve dependency Android studio 3.0.1

Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve javax.annotation:javax.annotation-api:1.2.
i tried this and it worked..
you just need to reset dependencies in app.gradle file like old one as
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
to this...
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

Resources