You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This happens when I tried using @OptionsItem on my app which happens to have a package name that starts with id. AA imports id.co.packagename.R.id so when it tries to inflate(id.co.packagename.R.menu.logout) java thinks the 'id' in the package name is the generated resource class R.id. I can't change the package name since it's tied to the company domain (indonesian domains have the ccTLD .id).
Since AA imports R.id, R.layout, etc, why doesn't it import R.menu as well, which would solve this? Either that or don't import anything and just use the fully qualified name (it's generated code anyway).
I'm using version 3.2. I apologise if this had been fixed in another version.
Unfortunetaly this is a little bit more complicated.
When we process your code, we do not know what way you passed the menu id, we only get the integer value. So if we want to know the R.xxx.yyy field, we have to scan the R classes and find the value you passed.
We could just use the value itself, but we have to get the field for two reasons in this case:
before generating code, we always validate the usage of the annotation, so we do not generate not compilable or not working code, but add a compile time error message instead. In this case, we have to be sure that the integer value indeed corresponds to a menu.
We want to generate as nice and readable code as possible. That's why we use the R.xxx.yyy constants in our generated code, not just simply the passed value.
However, the imports are fully created by our Java code generator dependency, codemodel. Unfortunately it has that bad import strategy, which leads to a non-compilable code in your case. I am afraid we cannot configure it.
Alright, that is understandable.
For posterity, if anyone runs into this problem, I ended up sidestepping the issue by copying over the generated code from Activity_.java and changed the inflate() line which only adds some 4 or so lines of code so it's not too big a deal.
as far as i understod his issue it is caused by R.menu usage.
AA imports id.co.packagename.R.id so when it tries to inflate(id.co.packagename.R.menu.logout) java thinks the 'id' in the package name is the generated resource class R.id.
Activity
WonderCsabo commentedon Feb 16, 2015
Unfortunetaly this is a little bit more complicated.
When we process your code, we do not know what way you passed the menu id, we only get the integer value. So if we want to know the R.xxx.yyy field, we have to scan the R classes and find the value you passed.
We could just use the value itself, but we have to get the field for two reasons in this case:
However, the imports are fully created by our Java code generator dependency,
codemodel. Unfortunately it has that bad import strategy, which leads to a non-compilable code in your case. I am afraid we cannot configure it.larvyde commentedon Feb 18, 2015
Alright, that is understandable.
For posterity, if anyone runs into this problem, I ended up sidestepping the issue by copying over the generated code from Activity_.java and changed the inflate() line which only adds some 4 or so lines of code so it's not too big a deal.
[-]Cannot use @OptionsMenu: cannot find symbol[/-][+]Problems with "id" package name prefix[/+]WonderCsabo commentedon Mar 22, 2015
Thanks for sharing the workaround us and for pointing out the problem in the first place.
WonderCsabo commentedon Jun 17, 2015
I am closing this issue for now, because there is no way to fix this currently. 😢
WonderCsabo commentedon Jul 8, 2015
@larvyde sorry, but can you explain the problem here again?
I tested this, and this code was created:
While this is ugly, but compiles and works. What is your exact problem?
dodgex commentedon Jul 9, 2015
as far as i understod his issue it is caused by R.menu usage.
WonderCsabo commentedon Jul 9, 2015
Thanks @dodgex, now i can reproduce the issue with the following annotated class:
WonderCsabo commentedon Jul 9, 2015
The good news is maybe this can be fixed by #1489.
WonderCsabo commentedon Sep 14, 2015
Opened issue against jcodemodel phax/jcodemodel#30.
yDelouis commentedon Oct 6, 2015
Should be fixed by #1566.