error: cannot find symbol variable abc_ic_ab_back_mtrl_am_alpha

24,750

Solution 1

The name of the resource was changed in the 23.2.0 support library.

Modify abc_ic_ab_back_mtrl_am_alpha to abc_ic_ab_back_material

Edit: In 23.2.1 the name of the component was changed back to abc_ic_ab_back_mtrl_am_alpha

Edit: In 24.0.0 the name of the component was changed to: abc_ic_ab_back_material

Solution 2

It looks like there are no images in raster format anymore because of the vector drawable implementation in the support library. So I put this vector drawable which represents the same arrow as it was in the previous version of support library. Right click on drawable folder, New -> Drawable resource file and paste this xml code:

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">

    <path
        android:pathData="M0 0h24v24H0z" />
    <path
        android:fillColor="#ffffff"
        android:pathData="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" />
</vector>

Source

For APIs <21 you will have to add these properties into gradle build file:

Gradle Plugin 2.0+

android {  
   defaultConfig {  
     vectorDrawables.useSupportLibrary = true  
    }  
 }

Gradle Plugin 1.5

android {  
   defaultConfig {  
     generatedDensities = []  
  }  

  // This is handled for you by the 2.0+ Gradle Plugin  
  aaptOptions {  
    additionalParameters "--no-version-vectors"  
  }  
 } 

See this blog post for more information.

Solution 3

In My case, I done like this

final ActionBar ab = mActivity.getSupportActionBar();
             ab.setHomeAsUpIndicator(android.support.v7.appcompat.R.drawable.abc_ic_ab_back_material);

Solution 4

I had this problem when updated the Android Support Library to version 23.2.0

In my case, I was using a third party library that conflicted.

I switched to the new version of the third party library to solve the problem.

Solution 5

Sorry that this might not be the answer you're looking for, but this happened to me too just a few minutes ago. I was alerted by Android Studio that there was a newer version of "com.google.android.gms" and "com.android.support" available in my Gradle file - at the time, I was using 8.3.0 for the former and 23.1.1 for the latter, so I updated to 8.4.0 and 23.2.0 and that's when I got the same problem as you, and Android Studio jumped to the values-v11.xml file in the library for AFollestad's Material Dialogs, and it seems that is causing problems because it uses the AppCompat library.

EDIT: Just found this, if you are using material-dialogs check if you're on version 0.8.5.5. If not, upgrade to it.

Share:
24,750
Nouvel Travay
Author by

Nouvel Travay

Updated on July 03, 2020

Comments

  • Nouvel Travay
    Nouvel Travay almost 4 years

    I added a Fragment to my Android Studio project using New > Fragment > Fragment (Blank). As a result when I try to run, the project won't compile because it cannot resolve R.drawable.abc_ic_ab_back_mtrl_am_alpha in

    toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
    

    Any ideas how to solve this?

    It looks like I also lost access to android:buttonTint

  • Danpe
    Danpe about 8 years
    Not exactly. this new resource is marked private in appcompat-v7
  • IgorGanapolsky
    IgorGanapolsky about 8 years
    I get an error: cannot find symbol variable abc_ic_ab_back_material
  • Jon
    Jon about 8 years
    In the last version of the support library (23.2.1) they changed it back to abc_ic_ab_back_mtrl_am_alpha
  • IgorGanapolsky
    IgorGanapolsky about 8 years
    @Jon You are absolutely correct. You should post this as an answer on this question, and you'll get upvotes. Thanks!
  • Jon
    Jon about 8 years
    Thanks - I'm glad it helped. I edited my answer to add the additional info
  • Ashraf Alshahawy
    Ashraf Alshahawy about 8 years
    @Jon What about abc_ic_menu_share_mtrl_alpha? I have the same problem with it.
  • JPM
    JPM about 8 years
    My latest build tools available is 23.0.3 I updated I don't see a 23.2.0 or 1
  • Jon
    Jon about 8 years
  • Artem Mostyaev
    Artem Mostyaev over 7 years
    abc_ic_ab_back_material can't be found on Android 4.4 and lower
  • Jon
    Jon over 7 years
    @ArtemMostyaev check out this question of mine: stackoverflow.com/questions/38467680/…
  • erginduran
    erginduran over 7 years
    they can change in every patch lol just download it and import your project manually its best solution for all
  • Dzmitry Lazerka
    Dzmitry Lazerka over 7 years
    Well, in 25.0.0 abc_ic_ab_back_material is declared private.
  • Atieh
    Atieh almost 7 years
    Where do you change this value?? It's automatically built
  • Samik
    Samik over 6 years
    I found solution and left answer here stackoverflow.com/a/46815356/4186707