Error cannot resolve class ' library' in xml file

559 Views Asked by At

I want this library but keep getting error in the layout ' cannot resolve class devs.mulham.horizontalcalendar.HorizontalCalendarView '
and 'Class referenced in the layout file, devs.mulham.horizontalcalendar.HorizontalCalendarView , was not found in the project or the libraries' which i tried to tools:ignore="MissingClass" but nothing changed.

I searched for solutions found this "https://stackoverflow.com/questions/71929304/i-get-the-error-class-referenced-in-the-layout-file-was-not-found-in-the-pro/71929922#71929922" but doesn't work, i also tried to invalidate cashes/restart, rebuild project/clean project, changing gradle classpath/version,.. deleting and reinstalling android studio

Here is build gradle, the library i need implementation 'devs.mulham.horizontalcalendar:horizontalcalendar:1.3.4'

    plugins {
    id 'com.android.application'
}

android {
    namespace 'com.example.calendarv511'
    compileSdk 32

    defaultConfig {
        applicationId "com.example.calendarv511"
        minSdk 21
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation 'devs.mulham.horizontalcalendar:horizontalcalendar:1.3.4'
}

Updated dependencies-gradle:

implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'devs.mulham.horizontalcalendar:horizontalcalendar:1.3.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'devs.mulham.horizontalcalendar:horizontalcalendar:1.3.4'
1

There are 1 best solutions below

6
ninhnau19 On

make sure you add jcenter in build.gradle(project level)

allprojects {
        repositories {
            ...
            jcenter()
            maven { url 'https://jitpack.io' }
        }
    }

And add support design library, such as

    implementation 'com.android.support:design:26.1.0'

or migrate to android X, using:

    implementation 'com.google.android.material:material:v.v.v'