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
Android: Choose Default Launcher Programmatically
How to Put My Libraries in Front of Android.Jar by Editing Build.Gradle in Android-Studio
Activitymanager.Getrunningtasks Is Deprecated Android
Generating iOS and Android Icons in Cordova/Phonegap
Is Main Thread The Same as UI Thread
How to Open Specific Contact Chat Screen in Various Popular Chat/Social-Networks Apps
Asynctaskloader Basic Example. (Android)
Difference Between Motionevent.Getrawx and Motionevent.Getx
How to Restrict My Edittext Input to Numerical (Possibly Decimal and Signed) Input
Android Studio (Not Installed), When Run Flutter Doctor While Android Studio Installed on Machine
How to Look-Up a Contact's Name from Their Phone Number on Android
Import an Eclipse Android Project with Version Control System into Android Studio
When Should I Do Certain Sqlite Operations on Another Thread(Not The Main Thread)
Switch Back/Front Camera on Fly
How to Measure Upload/Download Speed and Latency in Android Wifi Connection
Play Store Having New Version of The App, But Not Showing Update