Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, it seems like the Android platform has a few wrinkles when using library projects. I noticed that the R class of my project and the R class of the ZXIng library project were conflicting all over the place e.g.</p> <pre><code>public static final class id { ... public static final int mainmenu_btn_scan=0x7f070028; ... </code></pre> <p>And in the library project's R class:</p> <pre><code>public static final class id { ... public static final int share_app_button=0x7f070028; ... </code></pre> <p>This explains how a UI element from my activity was being picked up by an activity in the library project. Android will give priority to resources ids in the main project.</p> <p>This excellent article gave the solution: <a href="http://blog.blackmoonit.com/2010/12/android-sharing-resources-in-eclipse.html" rel="nofollow">http://blog.blackmoonit.com/2010/12/android-sharing-resources-in-eclipse.html</a></p> <p>In CaptureActivity (the activity I was calling in the library), I replaced</p> <pre><code>viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view); </code></pre> <p>With this</p> <pre><code>viewfinderView = (ViewfinderView) findViewById( getResources().getIdentifier("viewfinder_view", "id", getPackageName()) ); </code></pre> <p>This fixed the issue, although I'll need to go through and replace all direct id references with getIndentifier() to ensure there aren't any other conflicts. Not an ideal solution. It feels like there ought to be some fairly straightforward extension to the aapt tool to ensure that the ids between R classes don't conflict. </p> <p>See here for more info: <a href="http://devmaze.wordpress.com/2011/05/22/android-application-android-libraries-and-jar-libraries/" rel="nofollow">http://devmaze.wordpress.com/2011/05/22/android-application-android-libraries-and-jar-libraries/</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload