I'm trying to build a jar from the https://github.com/loopj/android-async-http source code but have been unsuccessful.
I also tried including the source as a library in my android project in android studio but was unable to.
I want to build from source because the jar's available in maven and in the github repo are too old and I want to use and test some of the new features available in the source.
How can I either build the jar and include the jar in my android studio project or simply properly include the source in my android studio project?
I was able to build the jar myself in ubuntu:
cd android-async-http/library
gradle build
That generated a build directory that contained a jar of the library.
Do you just need a Jar or you want to build the jar yourself. If you are just looking for the jar, they are already compiled and ready to download on this link here.
Looks like github download is not working. Use this link to download the latest android-async-http jar
Related
My android project is using ant build, And I cant upgrade to gradle build since im using gameclosure, a 3rd party game development tool.
Now I need to upgrade my google play services library.
I found that the required modules are:
play-services-base
play-services-basement
play-services-plus
play-services-play
from $SDK-PATH/extras/google/m2repository/com/google/android/gms
So I created individual android lib projects from above modules and added all as library project of main project.
Issue is that, play-services-base libs project whose package name is "com.google.android.gms.base", some of the class is referencing R.class file from package "com.google.android.gms". But correct value is present inside package "com.google.android.gms.base".
How to change to project settings/configs so that this R.class is generated in proper package???
Try to follow the instructions in this related thread. It suggested to try changing the android library reference to a relative path (relative to the current directory) instead of an absolute path. You may also check on this blog.
The Play library has to be included in your project.properties file like android.library.reference.1=../google-play-services_lib
because it has resources that need to be included. However, Ant will fail your build because Google no longer provides a build.xml for the Play library. You can generate the build.xml in the Play library by running android update lib-project --path <playlib_path>.
Hope this helps!
I have installed Android Studio but would like to use Gradle to build a simple "hello world" Java application that I have created outside of AS.
I have added the java plugin to my build.gradle file and ran `"gradle build" to try and build the .java file.
However, I am getting the error: "Gradle is not recognised as an internal or external command"
Do I need to install a separate version of Gradle, not bundled with AS to be able to build a java project?
Do I need to install a separate version of Gradle, not bundled with AS to be able to build a java project?
More or less.
There are two ways of using Gradle:
Download and install it, like you would most other development tools
Have a project set up for the Gradle Wrapper (gradlew and gradlew.bat files in the project root, plus the gradle/ directory containing the Wrapper JAR and properties file)
That latter approach will download a private copy of Gradle for this particular project, into the project's .gradle/ directory. This way, different projects can use different versions of Gradle without conflict.
Android Studio takes the latter approach; you can see the files that I mentioned in a newly-created Android Studio project, for example. For your own Java project, I'd do whatever is natural for your IDE that you plan on using for that project.
How can we get jar files/library files from Maven repo. Maven provides AAR file.
I know using Android Studio is best but I am facing some issues with my system, so for some time I have to use eclipse.
I want to get jar file/library project for this project
https://github.com/dmytrodanylyk/android-process-button/
Please suggest me some solution.
You can download the source from here and export in to your project and if you want you can create jar easily.
The code you're trying to get is an Android library, and requires some resource to work. You need to download the res folder too from here and you need to add it to your project res folder.
I have a fairly latest version of android studio, I have created a module under a project which is basically supposed to be a library, when I build it, it creates an ".aar" file , what I want is .jar file as this library is supposed to be used with eclipse as well.
The library contains activity as well, is there any way by which I can create a .jar file which I can use on Eclipse as well Android Studio ?
I have already created this module and tried building , as a result it generated .aar file and not a .jar file.
I found a way to achieve this, plain simple, using Gradle 2.2.1:
task jar(type: Jar, dependsOn: 'assembleRelease') {
from fileTree(dir: 'build/intermediates/classes/release')
}
Place this in your library module.
It will compile it as release and produce a JAR file in: build/libs.
bash gradlew jar or use your IDE to target that jar Gradle task.
aar is not related to AS or eclipse but is an AndroidARchive for Android applications like JavaARchives are for java applications.
Because Android is java based, jars can be used. But to take android specialities into account, like resource bundles, an aar is the right thing to use.
Currently gradle based builds doesnt seems to be allowing to create jar with android studio, I decided to go for Intelij it has necessary option and does what i want , i can use community edition.
***Update****
Even the jar produced by Intelij with resources don't work , obviously its not easy to have a jar with resource , so decided to opt for .aar and hoping that Eclipse also gets support for .aar when gradle supports lands there, as that was my main concern.
Add this in your library's gradle file:
task deleteJar(type: Delete) {
delete 'libs/traylib.jar'
}
task createJar(type: Copy) {
from('build/intermediates/packaged-classes/release/')
into('libs/')
include('classes.jar')
rename('classes.jar', 'traylib.jar')
}
createJar.dependsOn(deleteJar, build)
You need to check path of your generated classes.jar: build/intermediates/packaged-classes/release/
Create lib folder in your lib's root folder if it is not there
Go to gradle build: Android Studio --> View --> Toll Windows --> Gradle
Select your module(:library) --> Tasks --> other --> Double click on createJar task
You can just simply unzip the aar file to get the separated pieces of files.
I've created an Android project in Eclipse and I would like to add the Volley library to it. Searching on the web, I've tried these approaches:
Copy the .jar into the libs folder and right-click and add it to build-path.
Open the library as an android project, mark it as library and add it as a reference in my android app.
Nothing works. I still cannot access the classes provided by the library by importing the classes like follow: com.android.volley
Someone has a solution for this ?
The Solution:
Try this:
Add volley.jar to the libs folder. Don't add it to the build
path.
In Eclipse go to Project and make sure Build Automatically is selected.
Now in Project, click on Clean:
Project -> select Clean -> select the project.
As Volley doesn't have any resources like styles, layouts etc., its not necessary to reference it as a library project. The above should work, provided all steps are followed.
If this doesn't work ...
Make sure the library has not been added to the build path. If it is, then remove it. Now, try:
Closing and re-opening the project.
Restarting the IDE (last resort).
The build process for Volley has changed to Gradle. If you just want to use the library without building it, you can get the Jar from Maven or scroll down to the instructions to building it yourself lower in this answer.
Maven
An easier way to obtain the Jar file is to download it directly from Maven Central. You can find the latest version with this search:
http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.mcxiaoke.volley%22
At the time of writing the 1.0.19 version can be found here:
http://search.maven.org/remotecontent?filepath=com/mcxiaoke/volley/library/1.0.19/library-1.0.19.jar
Gradle
The new way to do it is to build the project using Gradle.
You can do this by running:
git clone https://android.googlesource.com/platform/frameworks/volley
gradle build
This will create a file in
build\intermediates\bundles\release
Then add this file into your libs folder and add it to your project.