Import scribe-1.2.1.jar in Android Studio - android

What are the steps to import scribe-1.2.1.jar in android studio?
I have added the jar in the lib folder and have also added it using the add library option. But when I compile I am facing compile time error.
Gradle: package org.scribe.builder does not exist

Edit your module's build.gradle file, just append one line in the dependencies scope.
dependencies {
...
compile files('libs/android-support-v4.jar')
compile files('libs/scribe-1.2.1.jar')
}
FYI: at this time Android Studio project setting did not affect the gradle build, so you must edit it yourself.
there are a user guide for gradle android plugin.

Related

Get the issue with import external library in Android Studio

I want to import the library https://github.com/jpardogo/FlabbyListView
First, I download the Zip file, then I extract it then I copy it to the lib folder of my project, then I turn on my project in Android Stduio. I add this line in the build.gradle compile 'com.jpardogo.flabbylistview:library:(latest version)'. But the Android Studio show:
How can I fix it?
You are mixing two concepts. If you use the compile dependency you don't have to put the jar in libs, and if you put the jar, don't put the managed dependency.
What the line compile library:artifact:version does is putting in your classpath in compile time the corresponding library, downloading it for you from a maven repository.
That said, I suggest you to remove the .jar and change your line of compile to:
compile 'com.jpardogo.flabbylistview:library:1.0.0
if you are manually adding the library to android. then you will add it to you project also.
In you settings.gradle file for the project add
include ':nameoflibrary'
or
include 'lib:nameoflibrary'
Where lib is the name of the folder you added the library and nameoflibrary is the actual name of the library.
then in you actual module usually the app-module gradle file add
dependencies {
compile project(':nameoflibrary')
}
or
dependencies {
compile project('lib:nameoflibrary')
}
same analogy too.
But if you are adding it from the repository you only need to add this line of code in your app-module gradle
dependencies {
compile 'com.jpardogo.flabbylistview:library:(latest version)'
}

Unable to import in android studio

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.
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
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
}
download the sweet alert library
In android studio [File] --> [New] -->[Import Module].
Now select the directory where you downloaded sweet alert library.
inside sweet alert library folder select library folder and the click ok.
Now go to your build.gradle(app) in your project and add this line
compile project(":library") into
dependencies {
...
...
...
compile project(":library")
}

Using google Place picker in android project

I am trying to learn Google's place picker
I have used the sample project from here
I have linked playservices library for the sample project
Resolved all the dependencies
Problem:
Some depedencies r not resolved ther are,
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.ui.PlacePicker;
Question:
How to solve this
Should I need to add any other project references
follow this way :
Open the build.gradle file inside your application module directory.
Add a new build rule under dependencies for the latest version of play-services.
For example:
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:7.0.0'
}
Be sure you update this version number each time Google Play services is updated.
Save the changes and click Sync Project with Gradle Files in the toolbar.
Answering because I had te same problem.
I needed to add 'com.google.android.gms:play-services-places to my project.
in the app's build.gradle I added
dependencies {
...
compile 'com.google.android.gms:play-services-places:10.2.6'
}

Error: package android.support.v7.app does not exist [ANDROID STUDIO]

I'm trying to compile a project using Android Studio and this error show up. I've already imported the appcompat in the build.gradle file:
dependencies {
compile 'com.android.support:support-v4:21.0.+'
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.melnykov:floatingactionbutton:1.1.0'
}
and in several files I've imported this:
import android.support.v7.app.ActionBarActivity;
Remove this dependency from Gradle file and add from
Project(right click) -> Project Structure ->click on your
application-> Dependencies -> Add button(right side) ->library
dependency -> Choose V7 libary.
Similarly add the module dependency using this way. Also before building the project make sure you do the same to the module project
Run gradle clean build command

How to Import jar file into an Android project?

I am trying to use the loopj library in my Android project. In the project home page it says "Download the latest .jar file from github and place it in your Android apps libs folder". I did that!
As indicated in the documentation of the loopj I try to import it using the following
import com.loopj.android.http;
and nothing happens. It is not even coming up in intellisense.
Am I doing anything wrong?
in the build.gradle file add your jar such as below then rebuild.
dependencies {
compile files('libs/android-async-http-1.4.4.jar')
}
into the build.gradle file add the following::
dependencies {
// ... other dependencies
compile files('libs/<your jar's name here>')
}
Rebuid your project or Run ./gradlew assemble. This should compile the project with the library.
To let the Android Studio load all of your jar files by itself automatically, just write this line in the dependency section
compile fileTree(dir: 'libs', include: ['*.jar'])
This will help android studio to load all of your jar files available in libs folder.

Categories

Resources