Reputation: 276
I am trying to use this library for Floating Action Buttons.I add
compile 'com.github.clans:fab:1.6.4'
to build.gradle as explained in usage and then add the code in xml, but unfortunately for me there is no functionality as expected. I get no errors just the floating button does not work.
So I start wondering if I should add the code of the library as well, although this makes no sense to me since I add dependency. Should I add the code to my project and how exactly should I make the connection between the library I added and my source code.
Sorry if this is a simple question, its just first time using such library for me.
Upvotes: 2
Views: 1645
Reputation: 96
If by "it doesn't work" you mean you don't have access to any of its classes in your code, make sure you also have the JitPack maven repository in your Project-level Gradle build file.
// Include repositories here for which dependencies can be retrieved from.
repositories {
maven {
url "https://jitpack.io"
}
// For example:
// google()
// jcenter()
}
If you do have access to the library in your code, and the library itself is not working as expected, I would check its github issues page for help.
As a last resort, you can pull the GitHub repository and compile the library yourself into an .AAR for your project.
Upvotes: 1
Reputation: 1606
Yes. You also need to add the code. Adding
`compile 'com.github.clans:fab:1.6.4'
only adds the library to your project files. To use it, you have to call it by creating an element in one of your layouts XML file.
tip: Whenever you get stuck in a problem like this, simply create a temporary project in Android studio and simply copy and paste all the code to your README.md to your project. Check out what each snippet does and then add that to your main project.
Upvotes: 1