Search code examples
androidcommand-lineandroid-support-librarybuildpath

How can I add a support library to android project from command line?


I was getting so annoyed with eclipse and how it runs for android that I recently switched to just setting up my projects from the command line (actually terminal I am using Ubuntu 14.04), and the SDK is really very easy to use this way and I find the process less vexing as a whole. One problem though. I can't figure out how to add the support libraries to the project. Of course I have copied the relevant library into the libs folder but how do I add it to the build path? For some odd reason when I looked on the Android developers site it covers this question for eclipse users but not how to do it from command line....


Solution

  • Of course I have copied the relevant library into the libs folder but how do I add it to the build path?

    If you are using Ant, just having it in libs/ adds it to your build path.

    If you are using Gradle, instead of copying the library, refer to the artifact from your top-level dependencies closure:

    dependencies {
        compile 'com.android.support:support-v4:19.1.0'
    }
    

    If you are building some other way, please edit your question to explain how you are "setting up [your] projects from the command line".