Correctly import third-party jar packages in Android

Source: Internet
Author: User

Correctly import third-party jar packages in Android

Andriod If you introduce a jar package in the wrong way, there are some strange errors.

At work there is a jar package that needs to be called, and it takes a long time to resolve the bug.

At first it was this quote (Eclipse):

Right-click Project, build Path,java build Path,

Select libraries, click "Add External JARs" On the right button,

Then choose the appropriate jar package (most people should do it).

Results Console immediately error: conversion to Dalvik format failed with error 1.

There will also be red forks on the project, although there are no errors in the project.

Clean, the project is OK, but the bin of the apk file and Dex files are gone, run the project error: Can not find **.apk later found that the reason is because the way to import the jar package,

The correct method is as follows:

1, right-click Project, build path, Java build path,

2, select Libraries in the right button click on "Add Library"

3. Select "User Library" and click "Next"

4. Click "User Librarys" button to click "New" in the interface that appears. Button

In the pop-up screen, click on "OK" to pick up a name.

5, click the "Add Jars" button to select the third-party jar package,

Click "OK" to complete the operation. In this case, the jar package will be packaged together into the APK, the problem will be solved!

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.