-1

I've created Android Library Project which depends on three libraries : google-play-services_lib, android-support-v7-library and pull-to-refresh ( https://github.com/chrisbanes/Android-PullToRefresh/blob/master/library/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java )

I marked my project as library and want to create jar which can be used as jars are used is google_play_services and android-support library. My question is what I have to do to be sure that libraries that my project depends on are not included in my jar. I want 3rd person - who will use my library - to add them with my projectes as dependencies and get it work.

Unchecked export options in java build path is enough?

Aldo Borrero
  • 547
  • 4
  • 11
dzakens
  • 337
  • 3
  • 14

1 Answers1

0

I don't know exactly if you have used Gradle or not. But if it's the former, then you don't have to do nothing. If you have include your dependencies in your library project like this:

dependencies {
    compile 'whatever:library'
}

Then it's ok.

Note: If your project includes resources (like layouts and more) it can not be compiled as a jar!

Note2: If you didn't use Gradle, notify me in the comment and I'll update this post explaining how to achieve that.


UPDATE 1:

First of all, let me link you to another related answer I did the last week. It gives you useful links to learn Gradle in a hurry (at least all the basics).

Second, do you use Android Studio?

UPDATE 2:

It's just a matter of taste ;)! But with Android Studio (Intellij) you don't need to configure the extra step to get Gradle working.

Well, after you have read those links I've put before, the next step is to create a library project (in Android Studio it will generate the required folders/files automatically for you).

In your lib or library folder (where you put your source code of your library) in your build.gradle put the following:

dependencies {
    compile 'com.google.android.gms:play-services:4.4.52'
    compile 'com.android.support:gridlayout-v7:19.1.0'

    compile 'it.sephiroth.android.library.fork.actionbarpulltorefresh:actionbarpulltorefresh:0.9.92'
}

And with that you can generate your library in aar format.

NOTE: Android-PullToRefresh library is not Gradelized, so I had to search for another alternative that has been uploaded to MavenCentral (like sephiroth's one). Remember to use Gradle, please! To search already Gradelized libs!

Community
  • 1
  • 1
Aldo Borrero
  • 547
  • 4
  • 11