Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add project as library in Android Studio

I want to use this library in my project. I download the code and place it on my libs folder. Then I set on app.gradle:

dependencies {
    compile project('libs/android-support-v4-preferencefragment')
}

as I read in a previous question here but it's not working, android studio tells me it cant find the project

like image 835
andrew Avatar asked Jan 23 '26 11:01

andrew


1 Answers

The support-v4-preferencefragment project support local maven repository in this commit. So, you can deploy it into local maven repository and then reference it in your android studio application project.

  1. Clone the library project
  2. $ git clone https://github.com/kolavar/android-support-v4-preferencefragment.git
  3. Deploy aar library into local maven
  4. $ cd android-support-v4-preferencefragment
    $ ./gradlew uploadArchives
    Now, aar should be within your local maven repository. eg: ~/.m2/repository/com/android/support/support-v4-preferencefragment/1.0.0
  5. Reference it in the application project
  6. Add compile 'com.android.support:support-v4-preferencefragment:1.0.0' within the dependencies block of your app's build.grade.
    If there is no mavenLocal() within your repositories block, add it too.
like image 163
正宗白布鞋 Avatar answered Jan 25 '26 00:01

正宗白布鞋