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..
Related
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!
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
Sorry if this question is duplicated but I have searched for a while and couldn't find the answer.
I use Android Studio and Gradle to develop my app, gralde will auto download source code from maven but then inside Android Studio it's said that "Sources Not Found" and I have to drag drop or select the source files directly. This is very troublesome. Is there anyway that AS auto link the sources downloaded with the class, and when I ctrl + click on the class it will open the source file directly?
Edit: Some libraries like ButterKnife I can view source code directly, but others like MaterialEditext I have to select the source file manually.
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.rengwuxian.materialedittext:library:2.0.3'
ButterKnife can be found in External Library while MaterialEditext isn't. I don't know why.
Not every module you want can be selected automatically. Only those you can find in dependencies could be imported by Gradle. Take a look here:right-click at your project --->Open Module Settings--->Modules--->Dependencies--->Plus--->Library Dependency, and then you can select one Library Dependency. And then it will be added into your project by Gradle. Most importantly, What You Can See Is What You Can Get. If you can't see the module you want, maybe you need to download it somewhere else.
I know that there are different solutions with different libraries posted. But, could anyone help me with this one?
I've busting my head for the past couple of days, and I really don't know what to do. I already tried importing the modules in all the suggested ways from different posts. (Project Structure --> Dependencies --> Add dependencies), etc. My project does not show any errors, but when I run it, it throws me a compilation error that complains about some classes missing. The library only depends on the ViewPagerIndicator's library which I also imported.
here is a picture. Thanks!!!
NOTE:I also have tried it with Eclipse, but the problem is different there. The app crashes when I run it. When I uncheck isLibrary from Properties -> Android and erase those libraries, the app works.
Inspired by this answer, these are the steps I did:
Put the jar file (in my case, 'xxx.jar') into the libs folder of your project
Right click it and select Add as library
Type this in the dependencies part of build.gradle file: compile files('libs/xxx.jar')
Do a clean build. It can be done inside the android studio, but I also ran the gradlew.bat included inside the project folder
Now, the project should be built and run just fine.
You are referencing the library wrong. You need to add the dependency in the build.gradle file. I recommend you to read the documentation first. It's a long read, but totally worth it.
I noticed that a user uploaded the library as .aar file in his maven repo. You might want to use the library from his repo. The setup is very easy (you only need to include the dependency of the better picker library).
I have an android project containing only login module. I want to integrate this into another android project. I searched and got the answer that make JAR file of login module project or make that as a library project. At login button click i have to call activity of other project. How can i do this? Please provide best solution to do this integration.
Thanks in advance.
Please Help.
If you have some library module you like to reuse, best way would be to make plain jar project out of it. You can see example here:
https://github.com/ko5tik/jsonserializer
This project depends on android libraries and one built and put into repository (thisw is in deed on maven central) it can be referenced by your android project. ( either in IDE settings, or as maven dependency )
You have to be more specific your build environment.
You can create your own jar file from your classes and you can add it in your android project. See link below for more information, it may help you.
JAR files and Android Project