How to add Android libraries with resources without using Eclipse

后端 未结 1 470
时光说笑
时光说笑 2021-02-08 01:28

I would like to setup the Android v7 appcompat library in order to use the ActionBar. At

http://developer.android.com/tools/support-library/setup.html#

there is

1条回答
  •  长情又很酷
    2021-02-08 01:36

    OK, finally I found it out. The keywords are library project and command line.

    In order to add the appcompat v7 as library project to an own project using the command line the following steps worked for me:

    1. Create a copy of the folder android-sdk/extras/android/support/v7/appcompat into the own project space. You may call it anything, we will keep the appcompat name.

      cd my_project

      cp -r android-sdk/extras/android/support/v7/appcompat appcompat

    2. Generate a build.xml file for the library project: execute

      android update lib-project --path appcompat

    3. reference the library project and create the dependency in the project's project.properties file

      android.library.reference.1=appcompat

    4. build the main project:

      ant clean debug

      This will automatically build the support library, too. You generally need a clean build after adding a library or changing the target versions, so the build picks up all the changes.

    These are useful resources:

    • http://developer.android.com/tools/projects/projects-cmdline.html
    • Adding android library project to an android project prevents Ant from building

    0 讨论(0)
提交回复
热议问题