In android studio how do you git clone a project from github into the same project?
If I got your question correctly, you want to check out some library and add it as a dependency to your (gradle based?) project.
The prefered way would be to checkout it separately and built it as a library project. And if you have maven you can then install it to your local repository.
The other way (and probably what are you trying to achieve) is to add it as a submodule of your local repository.
git submodule add git://repourl.git yourSubmoduleFolder
Then you can add this library as a module dependency to your application module. (You don't have to use git submodules, you can always just get the repo as a zip and extract it into your project)
If you put your library under libraries folder in your project then you can do it like this.
Add this to your settings.gradle
include ':libraries:yourLibraryModuleName'
Add this to your build.gradle
dependencies {
compile project(':libraries:yourLibraryModuleName')
}
You should now be able to build your application with the submodule
Please note that this was just a quick answer, you can find more info on both gradle submodules and gradle module dependencies here on StackOverflow. I guess this should be enough to point you in a right direction.
It does not. However it's a good practice to put it in libraries or libs,...folder
Related
I would like to add this library so that I can use it on my android project but I can't figure out how to. I get that I'm supposed to clone it but it doesn't say into which directory I should clone it. I'm also not sure if I should use ant or maven, what those are, and how to do that. Any help would be appreciated.
This is the project I'm hoping to add it to:
https://github.com/mikeoles/swiftset
One more project i which is forked from bauerca/drag-sort-listview
is available for drag-sort-listview and dependency of that project is deployed on maven repository
https://github.com/ened/drag-sort-listview
Gradle is available on mvn repository. check this URL
https://mvnrepository.com/artifact/asia.ivity.android/drag-sort-listview/1.0
Add this to your android project
compile group: 'asia.ivity.android', name: 'drag-sort-listview', version: '1.0'
this project is not a library project instead it is an Android app project so what you have to do is to clone the repo https://github.com/mikeoles/SwiftSet.git and open this as an existing Android project.
FYI, you can check android project structure at this link https://developer.android.com/studio/projects/.
You can make the library support gradle. Or copy code to you project(the project has no update in last 5 years).
I have some application which has few modules that i want to to replace in submodule.
Can I do that in the current project. Create new repo with these modules.
Yes you can achieve this in following way :
Say your main project is in X_REPO\Project\app
Move your module in a separate repo say Y_REPO
Then add Y REPO as submodule in X_REPO\Module1
Now make the following changes in
settings.gradle
include ':Module1'
project(':Module1').projectDir=new File('../Module1/module_directory')
X_REPO\Project\app\build.gradle
compile project(':Module1')
Since Android Studio uses same gradle build system, same can be achieved in Android Project as well.
I am trying to add this project to my gradle project in Android studio. I tried using Gradle git plugin as described here but Gradle says it can not find those files even though i placed folders inside app folder in my project. I added in dependencies in gradle.build file to include project in build but no luck, it just says project does not exist. Does anyone know good tutorial or have any suggestion about this?
You could register the repository as a submodule like this
$ git submodule add my_sub_project_git_url my-sub-project
Then include the project in your settings.gradle file which should look like this
include ':my-app', ':my-sub-project'
Finally, compile the project as a dependency in your application build.gradle file like this
dependencies {
compile project(':my-sub-project')
}
Then, when cloning your project, you will only have to add the option --recursive to make git automatically clone the root repository, and all its submodules.
git clone --recursive my_sub_project_git_url
I hope it helps.
I use Volley, like others, as networking library in my projects. So in most tutorials, guidelines suggest to clone the project and follow the boilerplate steps to build the project.
Does anybody have any idea, why Google has not built the project into a ready-made Jar file, in order to ease the way?
In order to use Volley in your application, you can use a couple of solutions:
Add following dependency to your app's build.gradle file (according to Android the easiest way):
dependencies {
compile 'com.android.volley:volley:1.1.0'
}
Cloning the Github repository and then set as a library. For a complete description please refer to Android developer.
git clone https://github.com/google/volley
If you are using gradle in Android Studio Volley can be added with one line to the gradle.build file's dependencies.
dependencies {
compile 'com.mcxiaoke.volley:library:1.0.+'
}
If you are using Eclipse, Volley can be added as a library project which will save you having to create a jar.
If you use git, you can add the volley library project as a submodule by using 'git submodule add'
https://android.googlesource.com/platform/frameworks/volley/
I know this must be a pretty basic question, but I'm new to Android Studio and gradle, and I can't find any up-to-date info on this.
I'm trying to add this library to my project: android-segmented-control.
It doesn't look like I can add it to my build.gradle file (correct?). I'd like to do it that way, of course, and not download the project if possible.
If I do need to download the project, how do I link it up with my existing project? Again, I haven't been able to find anything that is current that describes this process for Android Studio 0.5.3
The library you mentioned does not seems to be pushed on maven central or any other maven repository. As this library contains resources files, you cannot add it as a jar.
The only way to use it is clone the git repository and add it as a module to your android app project.
Meanwhile, you can ask the author to make it available on a Maven repository like OSS sonatype
Thanks #Thomas Bouron for the hint !
I have pushed my library to maven center, so you just need to add the following dependency to your build.gradle.
dependencies {
compile 'info.hoang8f:android-segmented:1.0.0'
}
(A little late for #workInAFishBowl but it may be helpful for others.).