Where can i download Googles android package? (Not the apps) - android

Where can i download the jar file for com.android.support packages such as com.android.support:appcompat-v7 or com.android.support:design ?
I looked at mavenCentral and jCenter but there was nothing there.
EDIT:
probably get wasn't the right word to use. i want to download them and use them offline.

YOu can get it from gradle. If you are using Android Studio just go to build.gradle and add the following under depedencies
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:appcompat-v7:23.2.1'

Related

How to update the dependency libraries (for example Apache collection libraries) in Android Studio?

I know that in order to get the latest version of Android/Google libraries, I can always go to the Android SDK Manager and update the Android Support Repository / Google Repository.
How about to update the other dependency libraries, such as the "commons-net:commons-net:20030805.205232" from Apache collection libraries? Since it is able to add these libraries from a Module's dependencies, I assume there should be a way to update it within the Android Studio IDE, but so far all the solutions I found is to download the specific .jar and put in the libs directory.
Just curious if anyone know there is a way to update these libraries from within the Android Studio IDE like the Android/Google dependencies.
Android Studio & IntelliJ have a dependency setting window themselves. Though, it does not have a "update" feature as the SDK Manager does. Reason being: Updating a library can cause bugs, errors, or complete crashes in your app.
so far all the solutions I found is to download the specific .jar and put in the libs directory
Not sure where you read that... Remote Gradle dependencies are preferred in most cases.
such as the "commons-net:commons-net:20030805.205232"
Go find what you want in Maven Central, find the most recent version, click the "Gradle" tab, the copy that into your build.gradle section.
There is no automated process for this, as far as I know, though you should be able to auto-complete version numbers via the IDE while you type it out.
When you create a project under Android Studio, it generates for your gradle files which let you use dependencies. Gradle is like maven, you can find lot of documents on google.
Under "Project" tab -> Gradle Scripts -> build.gradle (Module app), you'll find something like this :
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.journeyapps:zxing-android-embedded:3.0.2#aar'
compile 'com.android.support:support-v13:23.4.0'
compile 'com.google.zxing:core:3.2.0'
compile 'com.android.support:support-v4:23.4.0'}
So you just have to put your dependencies and gradle will download them for you.
More here.

How to use a GitHub project in Android Studio

I know there are already similar question but I still could not find a way to do this. I want to use this github project in a new android app. Could anyone elaborate how to do that ?
It's easy.
For example, you want to add the library which is given below.
1)just take compile link --> compile 'com.intuit.sdp:sdp-android:1.0.2'
2)add it in app level gradle
dependencies {
compile 'com.intuit.sdp:sdp-android:1.0.2'
}
3)sync project
Now u can use easily this github library.
EDIT:
In the latest version of Android Studio implementation must be used instead of compile
So,
compile 'com.intuit.sdp:sdp-android:1.0.2'
becomes,
implementation 'com.intuit.sdp:sdp-android:1.0.2'
First,you need to download the project .Then,you should follow the steps below,in you project,chose Android studio File->new->import module.Find the path of the project which was downloaded just now into Source directory.The last step ,into project structure select dependencies, chose Module dependency,click Ok.So,you can use the github project in you new android app.Sorry,my english is very pool ,hope that can help you.

How to compile from a github repository from Intellij in the build.gradle file?

Let's pretend that I have a github repository at github.com/myprojects/myrepo
Let's also pretend that I have a project in IntelliJ with a build.gradle file that contains the following:
dependencies {
// android
compile 'com.android.support:appcompat-v7:21.0.0'
// google play services
compile 'com.google.android.gms:play-services:6.1.71'
}
I want to add my github project via Gradle so I imagine that the dependencies need to add something like:
compile 'github.com:myprojects:myrepo'
This obviously isn't how it works though since I get "Failed to resolve com.github:myprojects:myrepo
Actual examples which work:
compile 'com.github.satyan:sugar:1.3'
compile 'com.github.castorflex.smoothprogressbar:library:x.x.x'
Since I don't want to clone the repository into a libs folder, how can I add a compile command in the dependencies portion of my build.gradle file to compile from github so that I can simply add something like the following:
compile 'com.github.myprojects:myrepo'
compile 'com.github.castorflex.smoothprogressbar:library:x.x.x'
It works because this library is published in Central Maven.
compile 'github.com:myprojects:myrepo'
This obviously isn't how it works though since I get "Failed to resolve >com.github:myprojects:myrepo
It is not enough to push on github.
You have to publish you artifact on Central Maven or JCenter or a local maven. You can find some guides to publish on jcenter, for example this.

How to add recycle view in layout xml

I am following this link, as mentioned in the link I am trying to add recycle view as follows:
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
I have added android-support-v7-appcompat library project and also tried adding recyclerview-v7-21.0.0-rc1.aar to libs but still I am getting following error.
The following classes could not be found:
- android.support.v7.widget.RecyclerView
Note: I have updated Android SDK Tools, Android SDK Platform Tools, Android SDK Build Tools, Android L (API 20, L Preview)
please help..
You can't add the aar file to libs folder in Eclipse (it isn't a jar file)
The best way to work with the new RecyclerView is, currently, to switch to Android Studio and add this dependency to your build.gradle
compile 'com.android.support:recyclerview-v7:+'
Just a note. It is not a good practice to use the '+' placeholder, but in this case you are trying a preview release, so it will be update soon with stable release.
You can use one of these versions.
Check your sdk for updated version:
//it requires compileSdkVersion 23
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.0'
//it requires compileSdkVersion 22
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
//it requires compileSdkVersion 21
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.2'
compile 'com.android.support:recyclerview-v7:21.0.0'
Of course you can still use Eclipse but it will requires some manual operations.
You can find all the release of the support libraries library in this folder:
sdk/extras/android/m2repository/com/android/support/
Here you can check all version.
In the folders you will find the aar file of the support libraries.
Inside you can check the classes.jar file,the res folder and the AndroidManifest file.
Create a project in your workspace
Unzip the AAR into some directory.
Copy the AndroidManifest.xml, the res, and assets folders from the AAR into your project.
Create a libs directory in your project and copy into it the classes.jar
Add the dependency.
Use the SDK 23 to compile
Mark the project as a library
The Recyclerview library has the support-v4.jar and the support-annotations-23.x.X.jar as dependencies.
ECLIPSE
If your problem is not solved or for future readers , here is the answer: From android sdk manager download Android Support Library first.
Go to this location and copy .aar file from here
X:\android-sdk\extras\android\m2repository\com\android\support\recyclerview-v7\21.0.0
Then rename it as .zip file then unZIP it then find classes.jar file , rename it with some proper name like 'RecyclerView_v7.jar' Then copy the that .jar file in you project library. Add it to build path then restart eclipse so that it can be instantiated (not necessary but i had to do this).
**=================================Update=======================**
After new Library Updates; RecyclerView,CardView etc are available as simple library projects.! :)
File~>Import~>Existing Android Code~>SDKpath~>extras~>android~>support~>
v7~>recyclerView.
Then right click on this project , go to properties under Android check Is Library. It is done ..!
Now open your app in which you want to use recyclerView.
goto properties of your app Project under Android add Library here you will find that Library project add that (remember don't make your app a library project by checking 'Is Library'), now go to your App Project's
Properties~>Java Build Path~>Libraries~>Add Jars~>RecyclerView LibraryProject~>libs
Then add that jar into your project and buildpath .! Pheeew.. :)

How to import Google API in Android Studio

I'm trying out Android Studio. I want to use Drive API in my project. In eclipse, there is a Google Plugin for Eclipse, but how about Android Studio? Does anyone tried it so far?
Bellow you can find last versions for Google Drive (2014.12.28):
//Google Drive API
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.google.api-client:google-api-client-xml:1.18.0-rc'
compile 'com.google.http-client:google-http-client-gson:1.18.0-rc'
compile 'com.google.api-client:google-api-client-android:1.18.0-rc'
compile 'com.google.apis:google-api-services-drive:v2-rev155-1.19.0'
To check last version try following links:
https://developer.android.com/google/play-services/setup.html
https://code.google.com/p/google-api-java-client
https://developers.google.com/api-client-library/java/apis/drive/v2
http://mvnrepository.com/artifact/com.google.apis/google-api-services-drive
I was in the same situation and had to find here an there information on how Gradle works to find the right set of dependencies and exclude needed.
Here the lines needed in the dependencies of your build.gradle file
// Replace 'dependencies' in your build.gradle file with the following
// or add these to whatever other dependencies you have.
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.google.android.gms:play-services:4.0.30'
compile('com.google.api-client:google-api-client-xml:1.17.0-rc') {
exclude group: 'com.google.android.google-play-services'
}
compile 'com.google.http-client:google-http-client-gson:1.17.0-rc'
compile('com.google.api-client:google-api-client-android:1.17.0-rc') {
exclude group: 'com.google.android.google-play-services'
}
compile 'com.google.apis:google-api-services-drive:v2-rev105-1.17.0-rc'
}
As they keep changing in time, I've made a gist that I'll keep updated as things changes.
I've wrote an article to modify the Google Drive Quick Start to make it work with Android Studio; if interested you can find it here
EDIT: This Gradle Imports are to use the Google Drive API for Java, not the Developer Preview Google Drive API integrated with the Google Play Services.
The Java client library supports Android, as well. You can download it here: https://code.google.com/p/google-api-java-client/wiki/APIs#Drive_API
Then, unzip the Drive SDK download and move the folder into the libs section of your Project. For example:
/Users/-username-/AndroidStudioProjects/MyProject/MyProjectActivity/libs/
At this point, you can add the library to your project by clicking File -> Project Structure, and then clicking the Libraries tab, and the + sign to add the SDK into your project.
You can read the Android-specific development instructions for the Google API Client Library for Java here: https://code.google.com/p/google-api-java-client/wiki/Android
Did you try
Go to Project Structure > Global Libraries / Libraries > Link to the jar of the API you need in the SDK folder
Link the library with your module
I haven't tried google driver, but I tried google usb accessory api. In my case
Open MyProject/MyProject/build.gradle
add
compile files("libs/usb.jar")
to the dependencies block
Of course, copy the google driver libs from
android-studio\sdk\add-ons\addon-google_apis-google-10\libs\usb.jar
to MyProject/MyProject/libs
Good luck to you.
smokybob's answer worked but then I did some experiments and this also worked for me.
dependencies {
compile files ('libs/libGoogleAnalyticsServices.jar')
compile ('joda-time:joda-time:2.3')
compile ('com.google.code.gson:gson:2.2.4')
compile 'com.google.android.gms:play-services:4.1.+'
}
I am guessing the joda-time and Gson have nothing to do with the drive API.
Note when I do a
gradle dependancies
I get
+--- joda-time:joda-time:2.3
+--- com.google.code.gson:gson:2.2.4
\--- com.google.android.gms:play-services:4.1.+ -> 4.1.32
\--- com.android.support:support-v4:19.0.1
From the Extra's under the SDK manager, I downloaded Google Play Services, Google Repository and Android Support Library. Thereafter, I included dependency as below, sync'd with Gradle and was able to access the APIs.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// Pls. install or update the Google Repository through the SDK manager to use this dependency.
compile 'com.google.android.gms:play-services:5.0.+'
}

Categories

Resources