How to retrieve view id from application compiled and obfuscated by proguard?
I'm writing tests for application that is compiled and obfuscated. Currently to access View
I use Id form /res/values/public.xml
View myView = solo.getView(0x7f0b0030);
solo.clickOnView(((LinearLayout) (myView)).getChildAt(3));
This approach is valid开发者_开发问答 only util application is not recompiled.
Is there any way to acces view by Id
without having R
file?
You can access ID of a resource by name using Resources class.
For example:
getResources().getIdentifier("my_image", "drawable", "com.my_package");
The same trick should work for layout as well.
AFAIK there is no method to access Id without R file.
If you came to know about solution please share your finding so that other can also benefitted.
精彩评论