R.drawable.icon - cannot find symbol

ultranol picture ultranol · Jun 26, 2014 · Viewed 7.3k times · Source

I have this on my code:

    Notification notification = new Notification.Builder(Extension.mainContext)
        .setContentTitle(title).setSmallIcon(R.drawable.icon)
        .setContentText(message)
        .setContentIntent(pIntent).build();

When I try to compile it, this happens:

[javac] /.../MainApp.java:42: cannot find symbol
[javac] symbol  : variable icon
[javac] location: class android.R.drawable
[javac]             .setContentTitle(title).setSmallIcon(R.drawable.icon)

Everywhere on Google it says I should put icon.png on res/drawable folder. I'm using Haxe/OpenFl so it generates folders for all resolutions: drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xhdpi, and the file is in all of them. Initially I thought it was the lack of an actual "drawable" folder, but I've manually created it and it didn't help.

Does anyone think of anything else that could be impacting this?

Thanks.

Answer

TooManyEduardos picture TooManyEduardos · Jun 26, 2014

What does your import statement for R says in this class? It looks like you're importing android.R when you want to import yourpackage.R, or not import any R at all (should also default to your package)