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
List class without declaring the corresponding import, therefore the cannot find symbol error occurs. Adding the missing import statement (line 4 in Fig. 4(b)) solves the problem.
Any error that starts "cannot find symbol" means that the compiler doesn't know what that symbol (which can be a variable or a class name) refers to. In the second line of the error, where it says "symbol: class Scanner", that indicates that it doesn't know what the Scanner class is.
The "Cannot find symbol" errors generally occur when you try to reference an undeclared variable in your code. A "Cannot find symbol" error means that the compiler cannot do this. Your code appears to be referring to something that the compiler doesn't understand.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With