Solved: error: package android.support.v7.app does not exist / appcompatactivity not resolved

If you have ever seen an error like below, we have fixed this and got it resolved. The error and solution is like as below.

Compilation Error

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

Or an error like

 appcompatactivity not resolved 

Solution

Modify top level build.gradle file to add following lines:

NOTE: Make sure you are using same version for “appcompact” as that of “compileSdkVersion” . e.g. here we had compileSdkVersion as 27, hence appcompact version is 27.0.2

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
}
dependencies {
    implementation 'com.android.support:appcompat-v7:27.0.2'
}
Follow Lynxbee

Leave a Reply / Ask Question