1

I'm getting error while compile gradle project

Error:(128, 35) error: cannot find symbol variable ic_contact_picture

but such resource is most definitely available, Android Studio even show me picture of that resource in left border

Android Studio snippet

I tried clean, build, rebuild, restart or sync Studio/project, as advised i.e. here, all without success.

What I'm doing wrong?

Community
  • 1
  • 1
Rudolf Gröhling
  • 4,611
  • 4
  • 27
  • 37
  • please try another pic from your drawable folder not android one like `R.drawable.myimage` and tell us the result – Mounir Elfassi Dec 28 '15 at 18:47
  • 1
    I'm not seeing that drawable in android studio. Just download a graphic and put it in your drawable folder then use that. R.drawable.mygraphic – Xjasz Dec 28 '15 at 18:49
  • From autocomplete I can choose i.e. `android.R.drawable.ic_dialog_email` and then it works. But I want picture of user, so I found nice user picture `ic_contact_picture`, Android Studio does not offer it to me in autocomplete, but I know it's there, because Android Studio can find and show me the drawable, but, it cannot compile project with such resource. I don't understand why? – Rudolf Gröhling Dec 28 '15 at 18:54

1 Answers1

4

You are using the R class from the Android system, i.e. android.R. If the drawable ic_contact_picture is your own picture, then you want to use R.drawable.ic_contact_picture instead, without the android. prefix.

If you intended to use the Android system drawable, you have to copy the specific drawable to your app, since the ic_contact_picture is not made public by the SDK.

Floern
  • 33,559
  • 24
  • 104
  • 119
  • I want use android picture, I'm lazy to create my own :) – Rudolf Gröhling Dec 28 '15 at 18:50
  • @Vaclav this specific drawable is not public, so you cannot access it. If you want to use it, you have to copy it into your app. – Floern Dec 28 '15 at 18:56
  • So google don't want to share it with me. I thought I just can use arbitrary android resource. In that case, I'll copy it, although I don't think that its a good pattern to duplicate resources. Thank you! – Rudolf Gröhling Dec 28 '15 at 19:00