HttpClient for Android Jar generation

Source: Internet
Author: User

About HttpClient for Android introduction here is not much to say, here only introduce httpclient for Android. The way the jar is generated.
On HttpClient's Apache website, http://hc.apache.org/downloads.cgi, find the httpclient for Android download, is a zip or tar.gz, these two decompression is the source code, and there is no relevant jar file.

for this source of use, there are no more than two kinds :

1. As the library project use, but the official website to the source code is a gradle about the project, not a module, so if you use, you need to reinvent yourself!
2. Modify the source code to the required or direct use of the source code, packaged into a jar file. The source is a gradle package, so there's no need to use ant or maven for packaging, just use it!

to package using Gradle:
1, download the Gradle and configure the environment variables before using Gradle
Prerequisite: Install Gradle. The installation process is simple:
(1) Download Gradle
(2) Add Gradle_home/bin/gradle to $path.
2. Under the Decompression folder httpcomponents-client-android-4.3.5, can see two files Gradlew.bat (Gradlew for Linux use), Build.gradle.
3. First execute the Gradlew.bat, the execution process will be error: '
Failure:build failed with an exception.

    • Where:
      Build file ' g:...\httpcomponents-client-android
      -4.3.5\build.gradle ' line:110

    • What went wrong:
      A problem occurred configuring root project ' Httpclient-android '.

      Could not find property ' plugin ' on Com.android.build.gradle.LibraryExtension_
      [Email protected]

    • Try:
      Run with–stacktrace option to get the stack trace. Run With–info Or–debug
      option to get more log output.

BUILD FAILED

Total time:8.329 secs '

This error is the fault of compiling httpclientforandroid doc file, if the doc file is not needed now, the two tasks about Doc are commented out in the Build.gradle file, that is, the Code comment section:

//Task Createandroidjavadoc (type:javadoc) {//DependsOn variant.javacompile//Source = Variant.javaCompile.source//Classpath = Files (Android.plugin.bootClasspath, variant.javaCompile.classpath.files)//title "Apache HttpClient for Android $HC _ver API"//Configure (options) {//DocTitle "Apache HttpClient for Android $HC _ver API"//Bottom "Copyright &copy; ${inceptionyear}-${calendar.instance.get (Calendar.year)} "+//"<a href=\" http://www.apache.org/\ ">the Apache software foundation</a>. " +//"All rights reserved."//            }//        }////Task Createandroidjavadocjar (Type:jar) {//DependsOn Createandroidjavadoc//From Createandroidjavadoc.destinationdir//From ' NOTICE.txt '//From ' LICENSE.txt '//Rename ' (notice| LICENSE). txt ', ' meta-inf/$1 '//classifier = ' Javadoc '////Manifest {//From Sharedmanifest//            }//        }Artifacts {dist Createandroidjar dist Createandroidsrcjar//Dist Createandroidjavadocjar} signing { SignCreateandroidjar SignCreateandroidsrcjar//Sign Createandroidjavadocjar}

4. After modifying the Build.gradle file, save, and then execute Gradlew.bat, no more error! Next, execute the following command:

//生成不含源码的jargradle createAndroidSrcJar//生成含有源码的jar

HttpClient for Android Jar generation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.