0

I'm currently migrating my project to Androidx, after using the refactor option in android studio I still have few support lib imports in classes. When I tried changing 'import android.support.v7.widget.AppCompatImageView;' to 'import androidx.appcompat.widget.AppCompatImageView;', I got below compile error

Cannot resolve symbol 'widget'

I'm currently using 'Android Studio Electric Eel | 2022.1.1 (Jan 2023)' and all the support dependencies are replaced with androidx.

1
  • update your android sdk tools Commented Apr 10, 2024 at 13:54

1 Answer 1

0

It sounds like the appcompat library didn't get added to your Gradle dependencies properly.

As described on the appcompat page on the Android Developers site, add the following to the dependencies { block of your app-level build.gradle:

def appcompat_version = "1.6.1" // or whatever the latest version is on the above-linked page

implementation "androidx.appcompat:appcompat:$appcompat_version"
// For loading and tinting drawables on older versions of the platform
implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.