简体   繁体   中英

Generate gen folder for new create package folder

I'm working on a project, I have all the clases on the same package, lets suppose: "com.example.project".

But now I'm getting with many classes so I would like to classify them in packages as for example: "com.example.project.bluetooth", "com.example.project.dialer", etc...

So, to do this, I created a new package the same way I would create a new class. But when created, all the classes inside of it have error with all the R imports. I see this is because in the gen folder, there isn't no reference to the new package.

How can I solve this?

You should import yourpackageName.R instead of android.R . Hope it helps.

Note: Eclipse sometimes likes to add an "import android.R" statement at the top of your files that use resources, especially when you ask Eclipse to sort or otherwise manage imports. This will cause your make to break. Look out for these erroneous import statements and delete them.*

Replace

import android.R;

with

import com.example.myapp.R;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM