简体   繁体   中英

Can't import package android.support.v7.app (error: does not exist)

I tried looking into topics that already are on this site, but I couldn't fix my problem based on that and neither did authors I think.

I am trying to import android.support.v7.app.NotificationCompat .

Android Info p1

Android Info p2

I am new to this and I have been trying to get Android Studio to work, I am done with 1 project and after starting another I am stuck immediately with this:

error: package android.support.v7.app does not exist

build.gradle

You need to: import androidx.appcompat.app.AppCompatActivity .

Use it in the class the requires it eg MainActivity.

You should also have eg : implementation 'androidx.appcompat:appcompat:1.0.2'

If you don't want to change any code, just add the com.android.support version:

implementation "com.android.support:appcompat-v7:28.0.0"

However, as @Will suggested, using androidx is rather the current way to do it. androidx.appcompat:appcompat:1.1.0 is alike 29.1.0 (which doesn't exist).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM