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'
}
Android Android Build system Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Kernel Booting and Porting Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question