0

I'm not able to use android.support.v7.app.AppCompatActivity. It shows error on import android.support.v7.app.AppCompatActivity; as follows: Cannot resolve symbol 'v7'. I have even added implementation 'com.android.support:appcompat-v7:28.0.0' in the build.gradle.

After setting android.useAndroidX=true and android.enableJetifier to false in the gradle.properties, the above mentioned error resolves but instead, I'm getting an error as follows: ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.5.0-alpha02] AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:5:5-20:19 to override.
Even after adding tools:replace="android:appComponentFactory to AndroidManifest.xml, I'm getting the same error.

I'm using compileSdkVersion 28 and targetSdkVersion 28.

  • Actually, I have tried all the solutions given in the link that you have provided, but then the error **cannot resolve symbol 'v7'** shows up again, so that didn't work for me. My aim is to use `android.support.v7.app.AppCompatActivity` in my android project. – Achal Kumar Rai Sep 07 '20 at 04:57
  • You need to import `AppCompatActivity` from `androidx` not `android.support.v7`. – ADM Sep 07 '20 at 05:06

1 Answers1

0

This is primarily happening because you are using Androidx with the v28 support library , you can remove the v28 library if you are using the androidx library , if you are using the v28 support library do otherwise.

androidx.core:core:1.5.0-alpha02

Well the error says that because androidx core and v28 are conflicting. Use either one. And androidx core also has the same methods as the v7.AppCompatActivity has , so why don't you migrate it to androidx using

import androidx.appcompat.app.AppCompatActivity

AkkixDev
  • 450
  • 3
  • 12