Raphael | b8a884f | 2010-04-02 22:05:14 -0700 | [diff] [blame] | 1 | Sample: TicTacToeLib and TicTacToeMain.
|
| 2 |
|
| 3 | --------
|
| 4 | Summary:
|
| 5 | --------
|
| 6 |
|
| 7 | These two projects work together. They demonstrate how to use the ability to
|
| 8 | split an APK into multiple projects.
|
| 9 |
|
| 10 | Build is supported both via Ant (command-line tools) or via ADT (the Android
|
| 11 | plugin for Eclipse).
|
| 12 |
|
| 13 | --------
|
| 14 | Details:
|
| 15 | --------
|
| 16 |
|
| 17 | TicTacToeMain is the main project. It defines a main activity that is first
|
| 18 | displayed to the user. When one of the start buttons is selected, an
|
| 19 | activity defined in TicTacToeLib is started.
|
| 20 |
|
| 21 | To define that TicTacToeMain uses TicTacToeLib as a "project library", the
|
| 22 | file TicTacToeMain/default.properties contains the special line:
|
| 23 | android.library.reference.1=../TicTacToeLib/
|
| 24 |
|
| 25 |
|
| 26 | TicTacToeLib is the "project library". It can contain both source code (.java)
|
| 27 | and Android resources (anything under /res) that will be merged in the final
|
| 28 | APK. To define this is a library, the file TicTacToeLib/default.project
|
| 29 | contains the special line:
|
| 30 | android.library=true
|
| 31 |
|
| 32 |
|
| 33 | One important thing to realize is that the library is not a separately-compiled
|
| 34 | JAR file: the source and resources from the library are _actually_ merged in
|
| 35 | the main project and the result is used to generate the APK. This means that
|
| 36 | the main project can either use or redefine behavior from the libraries.
|
| 37 |
|
| 38 |
|
Xavier Ducrohet | cf99704 | 2010-05-06 17:35:35 -0700 | [diff] [blame] | 39 | To use the main vs library project:
|
Raphael | b8a884f | 2010-04-02 22:05:14 -0700 | [diff] [blame] | 40 | - In ADT, just open import both projects and launch the main project.
|
| 41 | - In Ant, use 'android update project' to create the build files and set the SDK location,
|
| 42 | and then run 'ant debug' on the main project.
|
| 43 |
|
| 44 |
|
| 45 | For more details on the purpose of this feature, its limitations and detailed usage,
|
| 46 | please read the SDK guide at
|
Xavier Ducrohet | cf99704 | 2010-05-06 17:35:35 -0700 | [diff] [blame] | 47 | http://developer.android.com/guide/developing/eclipse-adt.html
|
Raphael | b8a884f | 2010-04-02 22:05:14 -0700 | [diff] [blame] | 48 |
|