Android R Java Cannot Be Resolved to a Variable

Hello dev, meet me again (creatorb). Are you have experienced error like R cannot be resolved to a variable, sometimes i get that error like that when rebuild my project and next R file doesn't appear in the /gen folder. i confused, on my case it happens because there are similarities name between the packages name and package src gen name, and so i must change it to different name like this:

creatorb java R cannot be resolved

For example on my case, firstly the my packages name src is same with gen called gen called id.creatorb.muslimnews and i changed my src package to added activity on last name so it will be id.creatorb.muslimnews.activity, finally you can see my R.java has come and i can import my R.java now :) . Owh ya will you choose to change your gen package name not src package like me, isn't problem you can change it easy by go to your AndroidManifest.xml and search package, change it name and so your gen package name automatically change name as package name you have changed on AndroidManifest.xml. On other case somebody get error like that because their have a another error on layout xml then so it can't make automatically rebuild, don't forget to checking your xml file on res/layout, make sure it is not an error. Okkay dev, see you next post?

./creatorb

0 komentar :

Posting Komentar

Cancel Reply