Skip to content Skip to sidebar Skip to footer

With API 28 And "androidx.appcompat" Library Project Says "AppCompatActivity" Symbol Not Found

I updated my build and target version to 28 (Pie) and replaced the relevant dependencies. Now my project says Symbol not found on AppCompatActivity. I have tried to Clean project

Solution 1:

you should replace the target class.

eg.

import android.support.v7.app.AppCompatActivity;

replace to :

import androidx.appcompat.app.AppCompatActivity;

Solution 2:

Edit: Now you can easily migrate your project to androidx, Just click Refactor => Migrate to Androidx from menubar. enter image description here

Previously I did as follow.
With Clean and build and Rebuild project android studio did not clean the unused imports like imports from android.support.v7 so I removed them all manually from all activities. Now android studio suggests AppCompatActivity from the correct library androidx.appcompat.

Hope so it will help someone.


Solution 3:

Add Below lines in your gradle Properties:

android.useAndroidX=true android.enableJetifier=true

This will upgrade your project into Android X.


Post a Comment for "With API 28 And "androidx.appcompat" Library Project Says "AppCompatActivity" Symbol Not Found"