Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
866 views
in Technique[技术] by (71.8m points)

how to import your own github forked library into android studio

I found a nice open library on GitHub, I imported it into my Android Studio project using Gradle dependencies, but then I realized I need to make little modifications on it.

So I forked the library on my GitHub, done the modifications and asked for a pull request, but I can't wait until they approve and merge my modifications with the original code.

Is there a way to use dependencies to import my forked library (in my Github) into my Android Studio project, rather than the original library?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think the accepted answer is outdated. There is actually a really easy way to do this nowadays: jitpack.io

All you need to do is.

  1. add in your root build.gradle at the end of allprojects repositories:

    allprojects { repositories { ... maven { url 'https://jitpack.io' } } }

  2. Add the dependency in your app build.gradle:

    dependencies { implementation 'com.github.User:Repo:Tag' }

If you don't have any releases/tags, you can also just do com.github.User:Repo:branchname-SNAPSHOT to build from the latest commit on that branch.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...