So I am starting to work on some open source libraries that is out there, mainly I have found bugs with the library using my specific project. As far as I know the Gradle library dependency is cached somewhere and not accessible.
What I would like to do is be able to create a branch for the fix and test in my project. Is there efficient way of doing this or do I need to comment out my gradle dependency and do a manual import of the library and do the fix?
I think that project is available on GitHub? You have 2 options then:
Open a issue at the project and describe your problems. Maybe the author will fix them himself
Fork the Project. You can work on your own on it then and make a Pull Request later if you want to.
You can of course download the source code and modify it yourself locally too, but that's not the purpose of Open Source Projects I think :)
Related
I have one doubt regarding using library from GitHub to Android Studio if anyone help me to solve my doubt, I would be thankful.
My question is
if we want to use library from GitHub , we have two option
either we can use dependencies to import library in project
or we can download the library from GitHub and use it as a module in our project
from above option which one would be good way to use library? (from all perspective)
Dependency
Because whenever a new version of a library arrives you don't have
to continuously check and look for it, let your build tool take care
of that. It can be cumbersome to regularly download and manage
different versions of libraries. That's where build tools like
Gradle comes in and informs you about an update and download it for
you.
You should always use library from github via using dependencies. Why?
You probably won't have times to check and fix the bugs of the library in the future.
You need more time to learn about the library nuts and bolts to maintain and update the library in the future.
You probably don't have enough expertise about the domain of the library.
You need to catch and recreate the bugs you found in your system. So, you need to keep an exact version of each libraries in your project.
You can update and change your dependencies easily without afraid of introducing new bugs.
Make your project clean.
I would like to open source a library project that I am working on in android studio (hosted on GitHub) and allow others to include the project as a dependency.
Example:
dependencies {
compile 'com.test:myproject:1.0'
}
I've done some research, and have only discovered how to create a module and import it locally within my project. Does anyone know the necessary steps to take to achieve what I want?
Basicly you can publish your app on a public repository like maven or jCenter. The easiest way is to published on bintray, it's free for open source public library. You can use the following library to help you
Also, look into jitpack.io. It is easily the quickest way for getting a JVM projects up and ready especially if you're already using Github. Here's the extra docs for it as well.
I'm an android newbie, and would like to create a jar file for this library:
https://github.com/TonicArtos/SuperSLiM
I've read some other online answers which say that the gradle build file has to be modified, which I tried to do, but not sure if I did it correctly:
How to create an Android Library Jar with gradle without publicly revealing source code?
Can anyone help me with this??
My goal is to use the *.jar file to create an Android Binding Project within a Xamarin project to be able to use the library in Xamarin.
Thanks!
I've just created the necessary bindings, you can check out the (pretty simple) binding project on https://github.com/dmunch/SuperSLiM-binding or download the NuGet at https://www.nuget.org/packages/SuperSLiM/
I am not a Xamarin user myself, but a quick look at the Xamarin changelog indicates that you can use the Build Action of LibraryProjectZip to bind a .aar project, which is what SuperSLiM is.
To actually make sense of this, here is a blog post which may also be useful. From the article it seems you need to download the .aar file from one of the hosted locations, bintray or mavencentral, and follow some instructions to create the Xamarin binding.
I'm a beginner in Android programing, and I'm working with android studio...now i wander what is the best way for installing open sources libraries from gitHub.
my question is from organization principles point of view-
should i create a new package for every library and put all the library source code as is in that package? should the package be in the source.main.java folder?? (the one that the android studio creates automaticly).
sorry for the dumb question...it's just that im taking my first baby steps in a big scale program and i don't want to loose my head in the future because of bad organization practices.
There's no right answer to this question. A few wrong ways to do it, but common sense will guide you.
My advice:
Start by having the source of this open source code checked into your company's source control system somewhere and capable of being built or re-built as needed. Not necessarily in your project, but just getting the code checked in so it can't be lost or confused with the original author's ever evolving changes on GitHub.
As to how you consume it, you have several options.
Build the open source in it's own project (checked into source control, but separate from your main project). Then just take the drop of compiled files (.class, .jar, .lib, etc...) and check that into your main project. This is the most flexible option if you don't think you are ever going to need to change the open source code that often. Has the side benefit of being managed for several projects.
Drop the source code as-is directly into your project. This means you will always be rebuilding the code. This gives the most flexibility with evolving and changing the the code specific to your project needs.
There's probably hybrid solutions of these options as well.
The bottom line is that whatever you use needs to be copied and building in your own system. Because the code you pulled down from GitHub could go away or change significantly at any time.
A simple solution would be to use JitPack to import those GitHub projects into your gradle build.
First you need to add the repository:
repositories {
maven { url "https://jitpack.io" }
}
and then all the GitHub repositories as dependencies:
dependencies {
compile 'com.github.RepoOwner:Repo:Version'
// more dependencies...
}
Behind the scenes JitPack will check out the code and compile it.
I think you are looking for this. If you are using eclipse, you should check this
If you are looking for adding jar file to your lib, you can simply create a lib folder in your project and add jar file into the library and you must add the line compile files('jarfile.jar') in the build file(gradle build). If you are using eclipse you can follow this
By the way, creating a package for each library and putting all library source codes doesn't look sane to me. It is almost equivalent to recreating the project. I'm sure that it is not the proper approach.
If the third-party code is packaged as a .jar or a .aar and made available in public-facing maven repository (e.g. maven central), then you should add the library as a dependency in your build.gradle file.
If it is not available as a maven/gradle dependency, you could add the library's code to your project as suggested in other answers here. I have never liked that solution at all.
You could also build the .jar or .aar and add that to your project's lib directory, as also suggested by other answers here. For a small, simple project with few dependencies, that might make sense.
What I like to do for larger, longer-lived projects, is to set up my own Nexus server (a Maven repo server), and put the third-party dependencies there.
I was wondering what the easiest way is to display a simple graph of any sort based on values that I already have. I tried using a library but ended up with more errors than i can count. What is the trick to using libraries and can someone take a second and help walk me through the steps because online all i can find is tutorials that just go: Download this jar. put it in libs and tah dah. But I am not seeming to find such luck.
Is there a way to download it as if it was a compelete project and then just import it? Or do you have to go through and pick out each little thing?
Quoting the project documentation:
Recommended: If you use Gradle/Android Studio you can use the library from Maven Central.
Add that line to your build.grade file into the dependencies block:
compile 'com.jjoe64:graphview:3.1.3'
Download .jar file and copy it into the libs folder of your project.
GraphView-3.1.3.jar
Download or clone the git repository and link your project with the GraphView library project.
jjoe64/GraphView on GitHub
Since you have the question tagged with eclipse, option #2 would seem to be the most likely choice.
Note that the author also provides:
a series of demo projects
JavaDocs for the library
both of which may help you learn how to use it, as an adjunct to the rest of the documentation.