Cannot add external library to android studio project - android

I am trying to add https://github.com/jkwiecien/EasyImage to my Android studio project. When i add the line:
compile 'com.github.jkwiecien:EasyImage:1.2.1'
to my app's build.gradle file, it gives me:
Error(33, 13) Failed to resolve.

Add this line to your root build.gradle
repositories {
maven { url "https://jitpack.io" }
}

https://jitpack.io/#jkwiecien/EasyImage/1.3.1
If you're using gradle, you need two steps:
1. adding jitpack repository to the root build file
2. add your dependency to the EasyImage library to the app build file.

Please try Latest one
dependencies {
compile 'com.github.jkwiecien:EasyImage:1.2.3'
}
I found this answer here: https://android-arsenal.com/details/1/2725#package

Related

Why getting this error transformClassesWithDexForDebug while building apk?

While building apk I am getting this error:
Error Image
This is my gradle Image: gradle image
Note:- I started getting this error after including android-support-v4.jar to project
If anyone know this so please tell me why I am getting this error and how to solve It.
Your last line has a dependency of support-v4 using a jar file in your lib folder that you might have placed.
Either remove the file and the last line or remove the support-v4 dependency that you have highlighted.
Add the following to your project level build.gradle file if not already present
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Add the support-v4 dependency as follows to your app level build.gradle:
compile 'com.android.support:support-v4:24.2.1'
Remove the following along with the jar file:
compile files('libs/support-v4.jar')
Now your gradle will use the dependency and download the aar on it's own from the maven repository and not use the jar file that you have added.

failed to resolve com.android.support.constraint:constraint-layout:2.0.0-alpha4

I imported a project from my work-space. After this some errors were shown which I can't solve.
The message
Install Repository and sync project
was shown as a link, but clicking on it didn't solve my problem.
Add ConstraintLayout to your project.
To use ConstraintLayout in your project, proceed as follows:
Ensure you have the "maven.google.com" repository declared in your
module-level build.gradle file:
repositories {
maven {
url 'https://maven.google.com'
}
}
Add the library as a dependency in the same build.gradle file:
dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
In the toolbar or sync notification, click Sync Project with Gradle Files.
The constraintLayout is not available yet on any stable relase of Android Studio. You have to download the latest Android Studio Preview to use it.

getting issues while adding other gradle project as library

actually i have been trying to import another gradle project as library from github and i know that there are two ways to do that
1)by adding url to dependencies in build.gradle file
this method gave lot of errors
2)manually download library and import it as module, then add dependencies
and i somehow succeeded by using second method ..
after that gradle sync worked correctly but while running application it gives some bizzare errors like
Error:(23, 0) Gradle DSL method not found: 'ompile()'
Possible causes:The project 'AppIntro' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
and the github link is as follows
https://github.com/PaoloRotolo/AppIntro
i imported folder called as library in that....
You can add this library in many ways:
Add a simple dependency in your build.gradle file
Just use:
dependencies {
compile 'com.github.paolorotolo:appintro:3.4.0'
}
Use the jitpack plugin
Just add this repo to your build.gradle
repositories {
// ...
maven { url "https://jitpack.io" }
}
And the dependency:
dependencies {
compile 'com.github.User:Repo:Tag'
}
download the module (the library folder) locally.

Github Project not available on android studio

I forked a project and I made a little modification on https://github.com/oursgris/datetimepicker
How can I make it available in android studio ?
I tryied to add in build.gradle :
dependencies {
compile 'com.github.oursgris.datetimepicker:library:0.0.3'
}
I had an error : Failed to resolve: com.github.oursgris.datetimepicker:library:0.0.3
What did I missed ?
I manage to output aar file but I don't know how to make it available in android studio with a simple dependancy (like other projects)
Regards
You almost got it right. What was missing is that you need to add a repository that stores your 'aar' file. You can do this with JitPack:
repositories {
maven {
url "https://jitpack.io"
}
}
And then add your library as:
dependencies {
compile 'com.github.oursgris:datetimepicker:0.0.3'
}

How to compile forked library in Gradle?

I want to compile the following library in my project in build.gradle:
https://github.com/theDazzler/Android-Bootstrap
It is forked from https://github.com/Bearded-Hen/Android-Bootstrap, but no documentation in the repository explains how to include in in project.
I tried something like this:
compile 'com.theDazzler:androidbootstrap:+'
but gradle failed and shows error that library not found.
Edit: Can anyone fork it and/or publish it?
This fork isn't published in the maven central repo.
Then you can't use an import like compile com.theDazzler:androidbootstrap:+
You have to:
- clone this library locally as a module in your project
Clone the
https://github.com/theDazzler/Android-Bootstrap/tree/master/AndroidBootstrap folder in your root/module1 folder.
root:
module1
build.gradle
app
build.gradle
settings.gradle
Change your settings.gradle file in
include ':module1'
include ':app'
In your app/build.gradle file you have to add:
dependencies {
// Module Library
compile project(':module1')
}
Finally in your module1/build.gradle you have to check the level used for gradle plugin.
EDIT 31/10/2015:
You can use another way to add a dependency with a github project,using the github repo and the jitpack plugin
In this case you have to add this repo tp your build.gradle
repositories {
// ...
maven { url "https://jitpack.io" }
}
and the dependency:
dependencies {
compile 'com.github.User:Repo:Tag'
}
It can be simply done by using Jitpack.
Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
compile 'com.github.User:Repo:Tag'
}
for eg: compile 'com.github.sachinvarma:JcPlayer:0.0.1'
The issue is: has that theDazzler/Android-Bootstrap been published anywhere? In any gradle/maven repo?
The usual build.gradle file has a section repositories which should reference that maven repo.
So it is possible any project using theDazzler/Android-Bootstrap should reference the repo where it is published, And with a project like gradle-git-repo-plugin, you could publish that fork on its own release section to publish it.
That task gets wrapped into a publishToGithub task that handles committing and pushing the change. Then you can run
gradle -Porg=layerhq -Prepo=gradle-releases publishToGithub
You can also run
gradle -Porg=layerhq -Prepo=gradle-releases publish
to stage a release in the local github repo and commit it manually.
Hi i had the same issue but with a different project :)
So first you should have the library code on your dev machine.
Next steps are: add a new file called settings.gradle to the root of your project if its not already there.
inside add this:
include 'AndroidBootStrap'
project('AndroidBootStrap').path = "path/to/AndroidBootstrap/AndroidBootStrapLibrary"
also add include for your root project if its not there.
Inside your build.gradle file add
compile project(':AndroidBootStrap')
to add the dependency.
How your folder Structure should look:
root
YourProject
settings.gradle
YourProjectModule
build.gradle
AndroidBootStrap
AndroidBootStrapLibrary
build.gradle
In the end the files look like this:
settings.gradle:
include 'AndroidBootStrap'
project('AndroidBootStrap').path = "../AndroidBootstrap/AndroidBootStrapLibrary"
include 'YourProjectModule'
build.gradle (YourModule):
...
dependencies {
...
compile project(':AndroidBootStrap')
}
Maybe its necessary to modify some point but i hope you get the idea!
Cheers
Neri

Categories

Resources