Update AndroidMarketManager for Gradle and Android Studio

Android Market Manager

If you’re using the Android Market Manager library to simplify your app over different Android app stores, and are also using Android Studio, the latest update should make things easier for you.

Also, I have a new tip to include GitHub code in your project without having to download it – you can include it as a dependency.

Of course, if you’re still using Eclipse then skip this update, and just start working on migrating your projects.  It’s worth the effort.

Referencing a local library

First, if you have the module on your local drive (but not in the same project) then add the following in your settings.gradle (substituting the location as appropriate)

include ':AndroidMarketManagerLib'
project(':AndroidMarketManagerLib').projectDir = new File(settingsDir, '../AndroidMarketManager/AndroidMarketManagerLib')

Next, add the following to the build.gradle for your module:

dependencies {
    compile project(':AndroidMarketManagerLib')
}

Referencing a library directly from GitHub

I just discovered this neat trick to link to code in GitHub that’s not already in a repo.  It helps keep code clean if you’re not going to modify sources at all.

First, your module’s build.gradle must add a new repo for JitPack (the second line):

repositories {
    jcenter()
    maven { url "https://jitpack.io" }
}

Next, add the dependency to the same build.gradle.  Note that the final string is the commit version; you can update this at JitPack.io by entering the GitHub project url and picking the latest commit.

dependencies {
    ...
    // Use jitpack.io to capture https://github.com/TimMackenzie/AndroidMarketManager
    compile('com.github.TimMackenzie:AndroidMarketManager:bc272e410c') {
        exclude module: 'AndroidMarketManagerTest'
    }
}

That’s it!

 

Posted in Android permalink

About ProjectJourneyman

I am an experienced software engineer that has explored all sorts of development landscapes from fortune 100 companies to startups, as well as solo development. I think mobile development still has opportunities for small and independent developers to make a big impact, and I continue to explore the space. I share what I learn in hopes that it might inspire others.

Comments are closed.