For developing android applications by using Android Studio, generally we add dependencies in build.gradle instead of adding jars or libraries.
Example given below
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
How can i create own gradle dependency in android studio?
You have to publish your library on JCenter. You can find steps of publishing it on Google.
Related
AllInOneProject
|
GameFolder lib(aar)
|
swipeawayDialog lib
Toasty lib
I have allInOne project which contains my GameFolder library. Also my GameFolder library contains lots of libraries.
compile 'com.labo.kaji:swipeawaydialog:0.1.1'
compile 'com.github.GrenderG:Toasty:1.2.5'
compile 'com.github.zurche:plain-pie:v0.1.1'
compile 'pl.bclogic:pulsator4droid:1.0.3'
compile 'com.android.support:multidex:1.0.1'
compile 'com.facebook.stetho:stetho:1.4.2'
compile 'com.github.rubensousa:bottomsheetbuilder:1.6.0'
I dont want to add these libraries to my AllInOne project. Also if its possible , i dont want to download and add locally to my GameFolder library too.
Is there any way to add dependencies to AAR file ?
You would have to create a "fat AAR" one way or another. If you are distributing your library with Maven, you could also add the dependencies information to your configuration file and they would be fetched on demand when building a project with your library.
I am trying to migrate a project from Eclipse to Android Studio, the project can be build in Eclipse and was successful imported to Android Studio, however, I get Cannot resolve symbol 'GooglePlayServicesClient' error in Android Studio.
I followed the official tutorial to imported Google Play service in Android Studio, and an other package "com.google.android.gms.common.ConnectionResult" that used in my project does not have same issue. Only 'GooglePlayServicesClient' cannot be resolved.
I have also tried clean and rebuild my project, but the problem persists. What am I doing wrong?
Update:
My build.gradle
...
dependencies {
compile project(':libraryListViewAnimations')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services:7.0.0'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/commons-net-3.1-sources.jar')
compile files('libs/commons-net-3.1.jar')
compile files('libs/mail.jar')
}
GooglePlayServicesClient is obsolete and no longer included in the Google Play Services 7.x library. Google recommends using the GoogleApiClient instead.
See Accessing Google APIs in the Android developer docs:
"Note: If you have an existing app that connects to Google Play services with a subclass of GooglePlayServicesClient, you should migrate to GoogleApiClient as soon as possible."
Did you add compile 'com.google.android.gms:play-services:7.0.0' to build.gradle?
You can find more guide here . Hope this help.
Adding a gradle project with compile has been working for me very well, but I noticed after updating the Android studio to 1.2.2, or maybe the version just before it, that adding a library is not working anymore.
So for example I tried to add this and I did the "Sync Now" and it was successful but the library doesn't seem to be recognized. When I try to use ProgressWheel in Java and I hit ctrl+Enter it doesn't find the library, anyone have an idea of what should I do?
dependencies {
compile 'com.android.support:support-v4:21.0.0'
compile 'com.google.android.gms:play-services:+'
compile files('libs/universal-image-loader-1.9.3.jar')
compile 'com.romainpiel.shimmer:library:1.4.0#aar'
//the above libraries were added before the update, everything was
//working fine, the below isn't
compile 'com.pnikosis:materialish-progress:1.5'
}
Please note that I tried many other libraries and all had the same result.
The project README (front page of https://github.com/pnikosis/materialish-progress) says it's on Maven Central. Android Studio uses jCenter (by Bintray) by default. Add this in your module's build.gradle file:
repositories {
mavenCentral()
}
I am trying to migrate a project from Eclipse to Android Studio, the project can be build in Eclipse and was successful imported to Android Studio, however, I get Cannot resolve symbol 'GooglePlayServicesClient' error in Android Studio.
I followed the official tutorial to imported Google Play service in Android Studio, and an other package "com.google.android.gms.common.ConnectionResult" that used in my project does not have same issue. Only 'GooglePlayServicesClient' cannot be resolved.
I have also tried clean and rebuild my project, but the problem persists. What am I doing wrong?
Update:
My build.gradle
...
dependencies {
compile project(':libraryListViewAnimations')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services:7.0.0'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/commons-net-3.1-sources.jar')
compile files('libs/commons-net-3.1.jar')
compile files('libs/mail.jar')
}
GooglePlayServicesClient is obsolete and no longer included in the Google Play Services 7.x library. Google recommends using the GoogleApiClient instead.
See Accessing Google APIs in the Android developer docs:
"Note: If you have an existing app that connects to Google Play services with a subclass of GooglePlayServicesClient, you should migrate to GoogleApiClient as soon as possible."
Did you add compile 'com.google.android.gms:play-services:7.0.0' to build.gradle?
You can find more guide here . Hope this help.
I have been trying to add android-support-v13 in Android Studio 1.0.2
I have followed the steps here but I still get a build fail. Has anyone successfully managed to add android-support-v13.jar into Android Studio 1.0.2?
Below is my code in my gradle file.
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile fileTree(dir: 'libs',include: '*.jar')
Edit: I have installed extra support library from SDK manager and I have placed the .jar in my libs folder.
according to docs at this time:
The Gradle build script dependency identifier for this library is as
follows:
com.android.support:support-v13:18.0.0
lets hope that the docs are updated.
for the latest you should use:
compile 'com.android.support:support-v13:21.0.+'
same problem android studio 1.0.2 i solve that below
compile 'com.android.support:appcompat-v7:21.0.1'
compile 'com.android.support:appcompat-v7:+'