[Fixed] Android Dependency Error – Can't determine type for tag '<macro name="m3_comp_assist_chip_container_shape">?attr/shapeAppearan – Android

by
Ali Hasan
android macros react-native

Quick Fix: Change ‘compileSdkVersion’ from 31 to 33 in your app’s build.gradle file and use these library versions:

implementation ‘androidx.appcompat:appcompat:1.4.1’
implementation ‘com.google.android.material:material:1.6.0’

The Problem:

Problem Statement:

An Android application is encountering an error while building, specifically a dependency error related to a macro tag. The error message indicates that the type for the macro tag <macro name="m3_comp_assist_chip_container_shape"&gt;?attr/shapeAppearanceCornerSmall&lt;/macro&gt; cannot be determined.

Additional Details:

  • The affected Android libraries are androidx.appcompat and com.google.android.material.
  • The developer has attempted to update these libraries based on solutions found in Stack Overflow, but the error persists.

The Solutions:

Solution 1: Update Compile SDK Version

The error “Can’t determine type for tag…'” occurs because the Material library version 1.6.0 requires a compile SDK version of 33 or higher. To resolve this issue, update the compile SDK version in the app’s build.gradle file to 33:

“`
compileSdkVersion 33
“`

Solution 2: Downgrade dependent package

If the problem persists even after updating the mentioned libraries, try downgrading the package that depends on a newer version of material. You can identify the transitive package dependencies using the command:

./gradlew app:dependencies

Once you identify the offending package, downgrade it to an older version.

Q&A

What causes the dependency error?

The error can be related to a dependency between an older version of compileSdkVersion and libraries.

Is upgradding the gradle version the solution?

Not necessarily. Downgrading the version of dependent packages could also solve the error

What is the solution?

Change compileSdkVersion to 33 and use libraries versions 1.4.1 and 1.6.0 for appcompat and material respectively

Video Explanation:

The following video, titled "Remove Commented Dependencies | Android Studio Error Fix ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

Your browser can't play this video. Learn more ... Dependency Conflict | Remove Commented Dependencies | Android Studio Error Fix | WORKING.