I've been trying to use this solution into my android project:
https://github.com/jlhonora/multistatetogglebutton
I tried since several hours, but I only managed to messed up with everything, forcing me to delete everything, reseting android studio, clone my project and restart from scratch.
I tried the solutions explained in android arsenal but it didn't do the trick.
It's all in the README on the git page you linked.
You need to include the following line within the dependencies block of your build.gradle:
compile 'org.honorato.multistatetogglebutton:multistatetogglebutton:0.2.2'
Then you can use the library, once you have sync'd the build.gradle (which it should immediately ask you to do).
Related
I am very new to Mobile Development especially with the use of Android Studio and Java (but i'm familiar with the language already as i came from C#). But the challenge is i don't yet how to configure the project itself unlike what i can do in VS.
Basically i am trying to include a downloaded SDK, the package looked like it is the same as my project (contains Gradle, etc, etc, so i've thought this is Gradle Project).
What i have tried
is going to file -> Project Structure -> Dependencies -> Add Dependency. Which is basically including a Gradle Project from the options.
It went a-okay but i'm not aware yet it this was right? I checked the Docs from android studio and included the dependency in my Gradle.
It goes like this: implementation project(":MyDownloadedProject")
I know this is pretty simple but i've been checking out stuffs for a long time already but unable to find any useful resource.
Thanks a lot!
Add build dependencies with autolinking or by manually adding to build.gradle
see https://developer.android.com/studio/build/dependencies
I want to add a native (integration test) module to a Cordova Android project.
For fully native projects, you just add a new module, commit and be done with it. But for Cordova I of course don't really want to mess with the generated Android project as some of these changes might be lost on build etc.
I got a Poof of Concept of the module working manually by having the module folder outside of the Cordova Android folder and adding this to settings.gradle:
include ':module-androidTest'
project(':module-androidTest').projectDir = new File("../module-tests")
But of course line 1 of that file already says
// GENERATED FILE - DO NOT EDIT
Is there any other way to add additional modules to a Cordova Android project?
Some approaches I researched or thought about:
Can I somehow do this with build-extras.gradle? (I don't think so as settings.gradle is several steps before build-extras and build.gradle, right?)
Older StackOverflow questions suggest manually editing a GradleBuilder.js file: https://stackoverflow.com/a/35504783/252627 But of course this would get lost each time I completely generate a new Cordova project. Not a good idea, correct?
Can I maybe work around this somehow via a Cordova plugin? I know these can load frameworks etc - maybe also a module somehow?
I think what you are looking for can be done using a custom plugin which can extend the base gradle config using a framework tag like this:
<framework src="relative/path/to/your/gradlefile/*.gradle" custom="true" type="gradleReference" />
This is how a cordova-android project is usually extended.
I am currently working on an android app. I decided to add some animation effects to it.
When I googled it, I came across this GitHub Project(I am new to GitHub).
I have downloaded the zip file and imported it into android studio using File-> Import Sample.
It created a new android studio project. I am not sure how I should use the new project to get the animation effects in my app.
Should I just copy paste the required modules and edit it to fit my app or is there some other way to do it?
EDIT:
Some websites that I referred say that dependencies should be added. What will the dependency for the given project?
The most libraries provide a gradle (or maven) dependency, you only have to add to your build.gradle e.g.
compile 'com.example.library:library:1.2.3'
For this project I could not find this dependency, so you could try these two approaches: Import the library in Android Studio. I never had to try these approaches, so I am not sure, if the are working.
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 have been working on Android applications for a while now. One problem I faced quite often is that new people have trouble keeping up with all the dependency of library projects. Things went from bad to worse with my latest project, which we use 7 libraries (2 developed in-house and a lot of open-sources). Right now we are using both Bitbucket and Github for our solution.
Is it possible to just combine all the projects under one Git repo? So we can just clone one and start working right away while maintaining the connection to the original repo of those open-source project.
For instance, it uses ActionBarSherlock, FacebookSDK, SlideMenu, etc.
If not, would Maven solve this problem?
Submodules are the solution to this problem.
You would add the repositories of those libraries as submodules to the repository of your app.
Yes. Assumed you have your 'main' project already setup and your local reg setup, and EGit.
Eclipse->rightclick on library project -> Team -> SharePrject-> git-> set Reg as the one your main is contained. If its a lib, then I suggest leave 'Path within reg' alone. ->finish.
You will get a bunch of errors. This is because the physcial location of the project has moved to the reg. Fix dependencies->Relink libraries( ex support-v4) -> readd library projects-> commit.
And of course don't forget to back up before doing anything.