@@ -21,6 +21,7 @@ page.title=Developing In Eclipse, with ADT
2121 <li><a href="#librarySetup">Setting up a library project</a></li>
2222 <li><a href="#libraryReference">Referencing a library project</a></li>
2323 <li><a href="#considerations">Development considerations</a></li>
24+ <li><a href="#libraryMigrating">Migrating library projects to ADT 0.9.8</a></li>
2425 </ol>
2526 </li>
2627 <li><a href="#Tips">Eclipse Tips</a></li>
@@ -644,10 +645,6 @@ across all projects). </p>
644645is because the library project is compiled by the main project to use the
645646correct resource IDs.</p>
646647
647- <p><strong>One library project cannot reference another</strong></p>
648-
649- <p>A library cannot depend on another library.</p>
650-
651648<p><strong>A library project can include a JAR library</strong></p>
652649
653650<p>You can develop a library project that itself includes a JAR library, however
@@ -664,13 +661,6 @@ application must declare the external library their manifest files, in a <a
664661href="{@docRoot}guide/topics/manifest/uses-library-element.html"><code><uses-library></code></a>
665662element. </p>
666663
667- <p><strong>Library project can not include AIDL files</strong></p>
668-
669- <p>The tools do not support the use of <a
670- href="{@docRoot}guide/developing/tools/aidl.html">AIDL</a> files in a library project.
671- Any AIDL files used by an application must be stored in the application project
672- itself.</p>
673-
674664<p><strong>Library project can not include raw assets</strong></p>
675665
676666<p>The tools do not support the use of raw asset files in a library project.
@@ -730,8 +720,76 @@ project can reference the library project by a relative link. You can place the
730720library project What is important is that the main project can reference the
731721library project through a relative link.</p>
732722
723+ <h3 id="libraryMigrating">Migrating library projects to ADT 0.9.8</h3>
724+
725+ <p>This section provides information about how to migrate a library project
726+ created with ADT 0.9.7 to ADT 0.9.8 (or higher). The migration is needed only if
727+ you are developing in Eclipse with ADT and assumes that you have also upgraded
728+ to SDK Tools r7 (or higher). </p>
729+
730+ <p>The way that ADT handles library projects has changed between
731+ ADT 0.9.7 and ADT 0.9.8. Specifically, in ADT 0.9.7, the <code>src/</code>
732+ source folder of the library was linked into the dependent application project
733+ as a folder that had the same name as the library project. This worked because
734+ of two restrictions on the library projects:</p>
735+
736+ <ul>
737+ <li>The library was only able to contain a single source folder (excluding the
738+ special <code>gen/</code> source folder), and</li>
739+ <li>The source folder was required to have the name <code>src/</code> and be
740+ stored at the root of the project.</li>
741+ </ul>
742+
743+ <p>In ADT 0.9.8, both of those restrictions were removed. A library project can
744+ have as many source folders as needed and each can have any name. Additionally,
745+ a library project can store source folders in any location of the project. For
746+ example, you could store sources in a <code>src/java/</code> directory. In order
747+ to support this, the name of the linked source folders in the main project are
748+ now called <<em>library-name</em>>_<<em>folder-name</em>> For
749+ example: <code>MyLibrary_src/</code> or <code>MyLibrary_src_java/</code>.</p>
750+
751+ <p>Additionally, the linking process now flags those folders in order for ADT to
752+ recognize that it created them. This will allow ADT to automatically migrate the
753+ project to new versions of ADT, should they contain changes to the handling of
754+ library projects. ADT 0.9.7 did not flag the linked source folders, so ADT 0.9.8
755+ cannot be sure whether the old linked folders can be removed safely. After
756+ upgrading ADT to 0.9.8, you will need to remove the old linked folders manually
757+ in a simple two-step process, as described below.</p>
758+
759+ <p>Before you begin, make sure to create a backup copy of your application or
760+ save the latest version to your code version control system. This ensures that
761+ you will be able to easily revert the migration changes in case there is a
762+ problem in your environment.</p>
763+
764+ <p>When you first upgrade to ADT 0.9.8, your main project will look as shown
765+ below, with two linked folders (in this example, <code>MyLibrary</code> and
766+ <code>MyLibrary_src</code> — both of which link to
767+ <code>MyLibrary/src</code>. Eclipse shows an error on one of them because they
768+ are duplicate links to a single class.</p>
769+
770+ <img src="{@docRoot}images/developing/lib-migration-0.png" alt="">
771+
772+ <p>To fix the error, remove the linked folder that <em>does not</em> contain the
773+ <code>_src</code> suffix. </p>
774+
775+ <ol>
776+ <li>Right click the folder that you want to remove (in this case, the
777+ <code>MyLibrary</code> folder) and choose <strong>Build Path</strong> >
778+ <strong>Remove from Build Path</strong>, as shown below.</li>
779+
780+ <img src="{@docRoot}images/developing/lib-migration-1.png" style="height:600px"
781+ alt="">
782+
783+ <li>Next, When asked about unlinking the folder from the project, select
784+ <strong>Yes</strong>, as shown below.</li>
785+
786+ <img src="{@docRoot}images/developing/lib-migration-2.png" alt="">
787+ </ol>
788+
789+ <p>This should resolve the error and migrate your library project to the new
790+ ADT environment. </p>
733791
734- <h2 id="Tips">Eclipse Tips </h2>
792+ <h2 id="Tips">Eclipse Tips</h2>
735793
736794<h3 id="arbitraryexpressions">Executing arbitrary Java expressions in Eclipse</h3>
737795
0 commit comments