Ravi Rupareliya Ravi Rupareliya - 1 year ago 145
Android Question

ShortcutManager cannot resolve symbol

Here i am performing demo for Android Shortcuts introduces in android nougat App Shortcuts

I have used following code to create app shortcut

ShortcutManager shortcutManager;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
shortcutManager = getSystemService(ShortcutManager.class);
ShortcutInfo shortcut;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) {
shortcut = new ShortcutInfo.Builder(this, "second_shortcut")
.setIcon(Icon.createWithResource(this, R.mipmap.ic_launcher))
.setIntent(new Intent(Intent.ACTION_VIEW,

But here i am getting compile time error
cannot resolve symbol ShortcutManager

Here is my

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
minSdkVersion 9
targetSdkVersion 24
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.1'

Answer Source

You need to update your dependency because ShortcutManager is added in API 25 as mentioned here so you should update/install the below components for API 25

  • Build-Tools
  • Install API 25 platform
  • Android Support Respository
  • SDK Tools
  • SDK Platform Tools

and make the necessary changes in your build-gradle file as show in the image too :

Update your following project’s values to 25

  • compileSdkVersion
  • buildToolsVersion

Follow the link to see the features updates provided in API 25 (v7.1)

And eventually it will look this, with succesful build using ShortcutManager

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download