Android resource linking failed. attribute iconGravity (aka com.bignerdranch.android.geoquiz:iconGravity) not found

Hello everyone,
I’m trying to add an icon to my GeoQuiz app like it described in Chapter 2, “Adding an Icon”. But when I’m trying to run my app it fails with error:

Android resource linking failed
com.bignerdranch.android.geoquiz.app-mergeDebugResources-48:/layout/activity_main.xml:43: error: attribute iconGravity (aka com.bignerdranch.android.geoquiz:iconGravity) not found.
error: failed linking file resources.

In activiy_main.xml everything like in the book.

I guess that something is wrong in my dependencies:

dependencies {

    implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))

    implementation 'androidx.core:core-ktx:1.10.0'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
    implementation 'androidx.activity:activity-compose:1.7.1'
    implementation platform('androidx.compose:compose-bom:2022.10.00')
    implementation 'androidx.compose.ui:ui'
    implementation 'androidx.compose.ui:ui-graphics'
    implementation 'androidx.compose.ui:ui-tooling-preview'
    implementation 'androidx.compose.material3:material3'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00')
    androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
    debugImplementation 'androidx.compose.ui:ui-tooling'
    debugImplementation 'androidx.compose.ui:ui-test-manifest'
}

Could you please help me to solve the problem?

It seems that the issue is that I am trying to add attribute iconGravity on Button which doesn’t support it . iconGravity is supported by com.google.android.material.button.MaterialButton so if I want to use iconGravity , I have to use MaterialButton, right?

You do not need to use MaterialButton directly in order to get the functionality of it in your app. I think your problem might be that you do not have the old Material design library in your dependencies. I think you used a different project template than the book when creating your app. Follow the directions here: Material Design

And see if that works.

Thanks! I removed all unnecessary dependencies. Also removed compose true from buildFeatures and it worked