How to add the jbcrypt library in Android Studio - android

Probably a very silly problem but I cannot add jbcrypt from mindrot.org https://www.mindrot.org/projects/jBCrypt/ to my existing android studios application.

add repository mavenCentral() in the project's build.gradle
and then add this dependency to the module's build.gradle:
dependencies {
implementation "org.mindrot:jbcrypt:0.4"
}

I don't know if this is the correct/best way to include jBCrypt into an android studio project. This is how I solved the problem in windows 10.
Go to GitHub and download this zip file -> https://github.com/jeremyh/jBCrypt
Extract, and cut out the BCrypt.java file and paste into the project under app/java/yourpackagename/ (add to same location as the android activities, or wherever you want to keep it organized)
Change the package name in the Bcrypt.java file so that your project will compile.
Finally, import the package, and google jBCrypt examples to understand how to use the class, or dive right into the source.
The only file you add to your project is BCrypt.java
Hope this helps!

Related

Adding features to my android project

I am new to android, and I started a project in android studio.
I found an interesting animation, which I would like to use, and perhaps edit in my project, it can be found here https://github.com/booncol/Pulsator4Droid
Now I wonder, how can I use this? I find the description on github hard to understand, I know that AS uses gradle to build, but where in the gradle file should I add the compile? And should I download some additional java files? And should I change my xml files?
I tried searching SO for answers, but one of the most relevant answers was about downloading a jar file, but there is no jar file to download in this case!
Thanx in advance.
You should add the compile line to your module gradle (under the mobile app folder) dependency section, something like this (ordering of the dependencies doesn't matter)
dependencies {
... other stuff may be here
compile 'pl.bclogic:pulsator4droid:1.0.3'
}
This will automatically download the java jar files required when you build.
Then where you want to use the pulsar control just add it to your activity xml file as specified in the projects readme under the usage section.
Add compile 'pl.bclogic:pulsator4droid:1.0.3' this in your app level gradle file

How add libarary which don`t have compile dependencies android studio?

I want to add DonwloadProvider library to my android studio project but it doesn`t have any compile dependencies.
so therefore I searched so much but did not find any related answer
please anyone help me with this it is very important for me
Download the Project from the github and add it under your project folder
Do the following steps
1. Goto File -> New -> Import Module.
2. Source Directory -> Browse the project path.
3. Specify the Module Name – it is used for internal project reference.
4. Let Android Studio build the project.
Open build.gradle (Module:app) file.
References:
How to add library projects

Android Studio - adding library

My problem is adding a library to my project in Android Studio. In module dependencies I'm gettin this weird thing. Any help will be appreciated.
Here is the pic:
android libraries are usually come as links to sources not as jars or some other type.
Take a look at the image. Do you see that there are actually 2 build.gradle files? what you need is the (Module:app) gradle build file select that and paste the link in the dependencies part in the bottom of that file just like what i have done , then Android Studio will ask you to sync the file. Do it. It will download the dependency from your link provided and integrate with the project
Hope this helps..

How to Import Module without creating copy in Android Studio

I am using Android Studio 1.3.1 and trying to add library module to an existing android application. The library module is available in a git repository. I am able to import the module, but it creates a copy inside the existing app. Hence I am not able to pull the updates in the module.
I am sure there is a way to import external libraries from an existing Android project in studio.
I found the below stackoverflow posts related to my doubt -
How to import a Module on Android Studio 0.5.1?
Android Studio 0.8.1 Creating Modules without copying files?
Both seem not to work for me. I also found couple of comments from other users saying it is also not working for them in the latest version of studio.
Here are the things that I tried
// in settings.gradle
include ':libraryName'
project(':libraryName').projectDir=new File('/path/to/library')
// in build.gradle
compile project(':libraryName')
Also I tried using this this url
Any help is appreciated. Thanks
You were on the right track. Just make sure your library is inside one folder then you can direct the library path like this..
Inside settings.gradle
include ':libraryName'
project (":libraryName").projectDir = new File("../FolderName/libraryName")
if your library is inside 2 folders then direct the path like this...
include ':libraryName'
project (":libraryName").projectDir = new File("../../FolderName/libraryName")
This allowed me to use the library without making a duplicate.
Is your path relative or absolute there?
Try this if you want to reference the other module relative to the current project:
include ':libraryName'
project(':libraryName').projectDir = new File(rootProject.projectDir, '../path/to/library')
Set the projectDir and by setting the rootProject.name it will also show up in your IDEs Project pane:
// in settings.gradle
include ':app'
rootProject.name = "Project name"
include ':libraryName'
project (":libraryName").projectDir = new File("../path/to/library")
// in build.gradle
compile project(':libraryName')
Have you tried creating a folder 'libs' under your project and copying the .jar file to that folder and try compile the libs folder? That seems to normally work for me. I think it was the first solution on this question
How to import a Module on Android Studio 0.5.1?

How do i import this project?

Hi I have found this github project:
https://github.com/ManuelPeinado/FadingActionBar
I have tried to import "samples-stock" and "library" into eclipse. Then I assign "library" as a library and add it in "samples-stock".
How would you make it work? I dont understand the authors instructions:
The library is pushed to Maven Central as a AAR, so you just need to add the following dependency to your build.gradle.
Thanks
Does your project, in which you want to use this lib, uses Gradle as build system?
If so, add dependency to build.gradle, as author suggests:
dependencies {
compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar:3.1.2'
}
Else, I believe Android Studio is Intellij IDEA Community Edition, just with android plugin, thus you should be able to add dependency from "Maven" in Libraries. Just copy & paste the
"com.github.manuelpeinado.fadingactionbar:fadingactionbar:3.1.2"
line to the window which opens.
In eclipse:
File->Import->Existing android code into workspace and import library from disk drive.
If you want to run samples that are present in that library you can run them as "Android Application", like any other project.
If you want to use it in your project:
Right click on your project -> Properties -> Android -> Add(select that library) and you are good to go.

Categories

Resources