Missing classes in xml - Android Studio

Viewed 38

I don't know what happened. I was making a update to SDK 32 and Gradle 7.4.2 of a old app to migrate to androidx, and was fine until the part of the xml files were they do not detect the androidx classes to use. Example, where it says "Cannot resolve class androidx.appcompat.view.menu.ListMenuItemView":

<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.view.menu.ListMenuItemView n1:layout_width="fill_parent" n1:layout_height="?listPreferredItemHeightSmall"
  xmlns:n1="http://schemas.android.com/apk/res/android">
    <RelativeLayout n1:layout_gravity="center_vertical" n1:duplicateParentState="true" n1:layout_width="0.0dip" n1:layout_height="wrap_content" n1:layout_marginLeft="?listPreferredItemPaddingLeft" n1:layout_marginRight="?listPreferredItemPaddingRight" n1:layout_weight="1.0">
        <TextView n1:textAppearance="?textAppearanceListItemSmall" n1:ellipsize="marquee" n1:id="@id/title" n1:fadingEdge="horizontal" n1:duplicateParentState="true" n1:layout_width="fill_parent" n1:layout_height="wrap_content" n1:singleLine="true" n1:layout_alignParentLeft="true" n1:layout_alignParentTop="true" />
        <TextView n1:textAppearance="?android:textAppearanceSmall" n1:id="@id/shortcut" n1:duplicateParentState="true" n1:layout_width="wrap_content" n1:layout_height="wrap_content" n1:singleLine="true" n1:layout_below="@id/title" n1:layout_alignParentLeft="true" />
    </RelativeLayout>
</androidx.appcompat.view.menu.ListMenuItemView>

It could be the issue of the dependencies, but they are included in the gradle.build file.

buildscript {
    repositories {
        mavenCentral()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
        google()
        maven { url "https://jitpack.io" }
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.2'
        classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-rc2'
        classpath "io.realm:realm-gradle-plugin:5.3.0"
        classpath 'com.android.tools.build:gradle:7.2.2'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'realm-android'

repositories {
    mavenCentral()
    maven {
        url "https://maven.google.com" // Google's Maven repository
    }
    google()
    maven { url "https://jitpack.io" }
    jcenter()
    mavenCentral()
}

android {
    compileSdk 32
    buildToolsVersion '30.0.3'

    defaultConfig {
        applicationId 'z.xtreamiptv.playerv3'
        minSdkVersion 24
        targetSdkVersion 32
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
    }

    buildTypes {
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
    }

    sourceSets {
        main {
            jniLibs.srcDirs = [ "src/main/lib" ]
        }
    }

    lintOptions {
        abortOnError false
    }
}

dependencies {
    // androidx
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'androidx.legacy:legacy-support-v13:1.0.0'
    implementation 'androidx.leanback:leanback:1.0.0'
    implementation 'androidx.core:core:1.8.0'
    implementation 'androidx.annotation:annotation:1.2.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.preference:preference:1.2.0'
    implementation 'androidx.activity:activity:1.5.1'
    implementation 'androidx.viewpager2:viewpager2:1.0.0'
    implementation 'androidx.navigation:navigation-common:2.5.2'
    implementation 'androidx.browser:browser:1.4.0'
    implementation 'androidx.slice:slice-view:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'androidx.appcompat:appcompat-resources:1.4.2'

    //google
    implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
    implementation group: 'com.google.android.material', name: 'material', version: '1.6.0'
    implementation 'com.google.android.material:material:1.6.1'
    implementation group: 'com.google.guava', name: 'guava', version: '25.1-android'
    implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
    implementation group: 'com.google.android.gms', name: 'play-services-ads', version: '21.2.0'
    implementation group: 'com.google.android.gms', name: 'play-services-cast', version: '21.1.0'
    implementation group: 'com.google.android.gms', name: 'play-services-cast-framework', version: '21.1.0'
    implementation group: 'com.google.firebase', name: 'firebase-auth', version: '21.0.8'
    implementation group: 'com.google.android.exoplayer', name: 'exoplayer', version: '2.7.1'

    // retrofit
    implementation group: 'com.squareup.retrofit2', name: 'retrofit', version: '2.4.0'
    implementation group: 'com.squareup.retrofit2', name: 'converter-simplexml', version: '2.4.0'
    implementation group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.4.0'

    // simple XML
    implementation group: 'org.simpleframework', name: 'simple-xml', version: '2.7.1'

    // butterknife
    implementation 'com.jakewharton:butterknife:10.0.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'

    // picasso
    implementation group: 'com.squareup.picasso', name: 'picasso', version: '2.5.2'

    // sectionedrecycler
    implementation 'com.github.IntruderShanky:Sectioned-RecyclerView:2.1.1'

    // matprogbar
    implementation 'me.zhanghai.android.materialprogressbar:library:1.4.2'

    // cirimgview
    implementation 'de.hdodenhof:circleimageview:2.2.0'

    // joda
    implementation group: 'joda-time', name: 'joda-time', version: '2.10'

    // squareup
    implementation group: 'com.squareup.okhttp', name: 'okhttp', version: '2.7.5'

    // bumptech
    implementation group: 'com.github.bumptech.glide', name: 'glide', version: '4.7.1'
}

Anyone knows what could possibly be? Thanks.

0 Answers
Related