Cannot resolve class com.google.android.gms.ads.formats.UnifiedNativeAdView

563 Views Asked by At

i am trying admobe native ads in app and getting this error on implementation 'com.google.android.gms:play-services-ads:21.5.0'

but working fine on implementation 'com.google.android.gms:play-services-ads:19.6.0'

my gradle file is

apply plugin: 'com.android.application'
android {
compileSdkVersion 32

defaultConfig {

        applicationId "xxx-xxx-xxx"
        minSdkVersion 19
        targetSdkVersion 32
        versionCode 1
        versionName "1.0.0"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
     
    buildToolsVersion = '28.0.3'
}
dependencies {
.....
implementation "androidx.multidex:multidex:2.0.1"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'com.google.android.gms:play-services-ads:21.5.0'
// implementation 'com.google.android.gms:play-services-ads:20.5.0'
........
}

here is the picture of my code error in XML file

error in xml file implementation 'com.google.android.gms:play-services-ads:21.5.0'

i tried implementation 'com.google.android.gms:play-services-ads:19.6.0' and it is working fine in this dependency but it giving error in implementation 'com.google.android.gms:play-services-ads:21.5.0'

i want to upade my dependency what will be the soultion for this error

1

There are 1 best solutions below

0
algodextrous On
apply plugin: 'com.android.application'
android {
compileSdkVersion 33

defaultConfig {

        applicationId "xxx-xxx-xxx"
        minSdkVersion 19
        targetSdkVersion 33
        versionCode 1
        versionName "1.0.0"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
}
dependencies {
.....
implementation "androidx.multidex:multidex:2.0.1"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'com.google.android.gms:play-services-ads:21.5.0'
// implementation 'com.google.android.gms:play-services-ads:20.5.0'
........
}

Update compileSdkVersion support to 33