Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Android library project doesn't run on itself, it is always compiled indirectly, by referencing the library in the dependent application and building that application.</p> <p>The only purpose of R.java generated in library project's gen folder is to accomplish the library project itself, so that IDE won't pop any compile error when seeing code like <code>resources.getString(R.string.c);</code> in the library project. The library project's R.java is more like a temp file, it will never get pushed into application project's apk file.</p> <p>Think the library project as two parts, the pure Java source (my-lib/src/) and Android resources (my-lib/res/). The pure Java source is compiled and end up as my-lib/bin/my-lib.jar (note that there is no R.class file in this so-called temporary jar), when you reference the library project in the application project, it does add my-lib.jar as a dependency in the application project (in Eclipse Package Explorer, check out <code>my-app -&gt; Android Dependencies -&gt; my-lib.jar</code>). The Android resources are globally merged and compiled later when ADT think it is time to do so, usually when application project is built for run/debug. </p> <p>The R java files that get compiled and packed into the final apk are those under application project's gen folder, in the apk file, they are injected under the corresponding package, like so:</p> <pre><code>com/ example/ lib/ R &lt;- com.example.lib.R.java ... ... &lt;- package/class from my-lib.jar app/ R &lt;- com.example.app.R.java ... ... &lt;- package/class from application project </code></pre> <p>The inconsistent R value generated between library and application project is not a problem, this is guaranteed by the SDK design. For you Robolectric pull request, always use R files from application project accordingly.</p> <p>Most of info I mentioned can be found in <a href="http://developer.android.com/tools/projects/index.html#LibraryProjects" rel="nofollow">Library Projects &amp; Development considerations section from official dev guide</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.
    3. 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