The simplest Android project (add jar file)

Source: Internet
Author: User

If your project needs to reference a third-party jar file, you need to make some changes to the build command.

First create the Libs directory in the project root directory and copy the required jar files inside.

There are two steps to be changed during the compilation process.

When compiling a Java source file, you need to add class path, which is the path to the-CP jar file, and if more than one jar needs to be used, separate multiple paths with semicolons, for example:

Javac-encoding utf-81.61.6 -bootclasspath \android\sdk\platforms\android- Android.jar-CP \android\sdk\extras\android\m2repository\com\android\support\support-v4\19.1. 0\support-v4-19.1. 0. jar-d bin\classes Src\test\android\mini.java Gen\test\android\r.java

When you package the DEX format, add the jar file, and if you have more than one jar, add a space, followed by:

D:\Android\sdk\build-tools\19.1. 0\dx.bat--dex--output=bin\classes.dex bin\classes \android\sdk\extras\android\m2repository\com\android\ support\support-v4\19.1. 0\support-v4-19.1. 0. jar

This adds the dependent jar file to the APK.

The simplest Android project (add jar file)

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.