-4

I am new to android studio. I know how to work in eclipse. I downloaded the sweet alert library for Android from here.

But I am unable to import it because of lack of experience in android studio. Can anyone guide me to import it step by step? I don't even know what a maven/gradle is and how to add as AAR dependency, as mentioned on the website.

halfer
  • 19,824
  • 17
  • 99
  • 186
Prakhar
  • 710
  • 6
  • 24
  • have you added it to your gradle dependencies? `dependencies { compile 'cn.pedant.sweetalert:library:1.3' }` – Conor O'D Apr 29 '15 at 10:31
  • @ConorO'D Sorry, I don't know how to add and how will it affect my code – Prakhar Apr 29 '15 at 10:33
  • There's no need for namecalling. – Conor O'D Apr 29 '15 at 10:33
  • open your gradle.app and add that line to dependencies – Conor O'D Apr 29 '15 at 10:33
  • 1
    please reffer this lib:http://www.dfg-team.com/en/android-tutorial-import-third-party-libraries-android-studio/ – manDroid Apr 29 '15 at 10:34
  • Didn't I clearly explain my problem? Why down vote then.. Ok I know this is not the site for " I want this " type of questions.. but I did not get solution anywhere so I had to ask – Prakhar Apr 29 '15 at 10:34
  • 2
    Downvoters maybe think you've not put enough effort before asking. In the github page where that library is is a clear __Setup__ section where you have all the required details. Also: if you don't know the bare basics of Gradle, read [this Google docs](https://developer.android.com/sdk/installing/studio-build.html). It's not a problem to be a _beginner_: we all are. It's considered a problem not to show _enough_ effort. – Diego Freniche Apr 29 '15 at 10:42

3 Answers3

0

Add the following lines to your build.gradle file:

repositories {
    mavenCentral()
}

dependencies {
    compile 'cn.pedant.sweetalert:library:1.3'
}

The first block makes gradle aware of the maven repository. The second block is shorthand for including the library in the "compile" build step.

Further I sugest that you read the gradle docs here: Gradle plugin user guide

khmysen
  • 33
  • 5
0

If you are importing Library which is gradle supported then you have to write only one line in your Gradle dependencies sweet-alert-dialog library is Gradle Supported so you the thing you have to do is open Gradle

dependencies {
    compile 'cn.pedant.sweetalert:library:1.3' //add this line
}
NarenderNishad
  • 1,058
  • 1
  • 17
  • 31
0
  1. download the sweet alert library
  2. In android studio [File] --> [New] -->[Import Module].
  3. Now select the directory where you downloaded sweet alert library.
  4. inside sweet alert library folder select library folder and the click ok.
  5. Now go to your build.gradle(app) in your project and add this line compile project(":library") into

dependencies {

... ... ...

compile project(":library") }

sivaBE35
  • 1,876
  • 18
  • 23