Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - put an image name "package" throws compile time error

I am trying to put an image name "package.png" in my drawable folder. As soon as i paste them it into the folder it is throwing following error:

[2012-05-26 12:40:30 - MyApp] res/drawable-mdpi/package.png:0: error: invalid symbol: 'package'

But as soon as i rename to some other name, this image works fine. Any idea why this is happening and how i can fix this and have a drawable named "package".

like image 970
mudit Avatar asked May 26 '12 07:05

mudit


1 Answers

you cant do that, as it is a Reserved word. just like...

break else new var
case finally return void
catch for switch while
continue function this with
default if throw
delete in try
do instanceof typeof
abstract enum int short
boolean export interface static
byte extends long super
char final native synchronized
class float package throws
const goto private transient
debugger implements protected volatile
double import public
null
true
false

Each resource having entry in java field name inside R.java class:

drawable\package.png -> R.drawable.package // while package is a reserved keyword in Java(mentioned above)
like image 166
Mohammed Azharuddin Shaikh Avatar answered Sep 19 '22 05:09

Mohammed Azharuddin Shaikh