Error "Package Android.Support.V7.App Does Not Exist"

Error package android.support.v7.app does not exist

Your project is missing the support library from the SDK.

If you have no installed them, just right click on the project > Android Tools > Install support library.

Then, just import into workspace, as an Android project, android-support-v7-appcompat, located into ${android-sdk-path}/extras/android/support/v7

And finally, right click in the Android project > Properties > Android Tab. Push the Add button and add the support project "android-support-v7-appcompat" as dependency.

Clean your project and the must compile and work properly.

package android.support.v7.app does not exist error in androidStudio

You are using androidx libraries.

 implementation 'androidx.appcompat:appcompat:1.0.2'

Then you can't use the import of support libraries classes.

It is the right class:

import androidx.appcompat.app.AppCompatActivity;

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

For latest version (3.4 or higher) of Android Studio

Instead of

import android.support.v7.app.AppcompatActivity

Use this

import androidx.appcompat.app.AppcompatActivity

In MainActivity.java or in main java file

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

You should replace android support recyclerview with androidx

implementation 'androidx.recyclerview:recyclerview:1.0.0'

And you can delete 'com.android.support:appcompat-v7:+' dependency, because you've already import it with

implementation 'androidx.appcompat:appcompat:1.1.0-rc01'

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

You are using androidx libraries.

Remove this dependency, since you are using the Material Components library:

implementation 'com.android.support:appcompat-v7:27.0.0'

Then change these classes (code and layout):

import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppcompatActivity;
import android.support.annotation.IdRes;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar

to

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.IdRes;
import androidx.appcompat.app.ActionBar;
//import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar

Here the full class mapping.

Android: package android.support.v7.app.AlertDialog does not exist

Try this code. I hope this will work. If AlertDialog not imported then re-import the androidx version.

private void showMessageOKCancel(String message, DialogInterface.OnClickListener okListener) {
new AlertDialog.Builder(addquantityactivity.this)
.setMessage(message)
.setPositiveButton("OK", okListener)
.setNegativeButton("Cancel", null)
.create()
.show();
}


Related Topics



Leave a reply



Submit