Prethia
Prethia

Reputation: 1203

Error while importing a library in github into Android

I was trying to use ion so I needed to use this library

I downloaded the zip file, extracted it put it into the root of my project inside a file called subProject.(only the ion folder not the other two) Then in my settings.gradle I added

 include ':app',':subProject:ion'

And I gave an error which said that there is no valid path in there so the project cant be cleaned. Then I changed it and added a compile statement to build.gradle

include ':app',':subProject'

compile project(':subProject:ion')

But when I try to use Ion.something it tells me it gives me an error since it cannot resolve what Ion is. How can I import this? The way I did it was the solution on the internet but it failed

Here is the code I try to use when I get an error for unknown symbol etc

Ion.with(getApplicationContext())
                .load("http://www.example.com/abc/def/")
                .setBodyParameter("identifier", "foo")
                .setBodyParameter("email", "[email protected]")
                .setBodyParameter("password", "p@ssw0rd")
                .asString()
                .setCallback(new FutureCallback<String>() {
                    @Override
                    public void onCompleted(Exception e, String result) {
                        // Result
                    }
                });

Upvotes: 0

Views: 189

Answers (1)

Paraskevas Ntsounos
Paraskevas Ntsounos

Reputation: 1777

Make your life easier, go to your build.grandle(Module:app) and add this code inside dependencies brackets like this:

apply plugin: 'com.android.application'

android {
 // leave code here as it is
}

dependencies{
 // other code here
 compile 'com.koushikdutta.ion:ion:2.+'
}

If you want my opinion you can use picasso library from github simply adding compile 'com.squareup.picasso:picasso:2.5.2'. I give you the link to check: HAPPY CODING

Upvotes: 1

Related Questions