Error in introducing third-party jar to Android

Source: Internet
Author: User

In andriod, if the jar package is introduced incorrectly, some strange errors may occur.
At work, a jar package needs to be called, and the result takes a long time to solve the bug. At the beginning, it was referenced like this (eclipse): Right-click the project, build path,
Java build path, select libraries, click "add external jars" in the button on the right, and select the appropriate jar package (most people should do this ). result The console immediately reports an error: conversion to Dalvik format failed with error 1. In addition, there will be a Red Cross in the project, although there is no error in the project. The method below will be compiled, but the class error cannot be found during running.
Right-click the project,
Build path,
Java build path, select Libraries
Click "add library" in the button on the right"
Select "User library" and click "Next"
Click "User librarys ".
On the displayed page, click "new ...".
In the pop-up interface, enter a name and click "OK"
Click "add jars" to select a third-party jar package and click "OK" to complete the operation.

In fact, some jar files cannot be used on Android. Refer to a post http://topic.csdn.net/u/20091118/16/5a27d8e7-d8a2-43b3-92db-9d88ff8f7bec.html

The following section describes the materials found online:

This problem was encountered some time ago when using a third-party mail package. One of the reasons for reading the relevant information is the android framework policy I mentioned above. But not comprehensive. Perhaps this is not the case with coffee tea. I am sorry for my hasty conclusion on the situation with coffee tea brother.

In the past two days, the problem of using third-party jar packages for Android has been worrying. What kind of jar packages can be used on Android platforms?
I will continue to consult relevant materials and communicate with foreign developers. The davlkvm of Android is incompatible with the bytecode format executed by our standard JVM. For this reason, Android provides the DX tool for converting the format of standard. class files.

According to the official documentation, we can use it when introducing third-party packages in the project. So I tried some packages, but most of them cannot be used. So I used the DX tool to perform the conversion operation separately and found that the jar packages that can be converted separately can be used normally. However, most jar packages cannot be converted using the DX tool. Therefore, third-party jar packages cannot be referenced.
I do not know why some jar packages cannot be converted using the DX tool. We hope that you can do further research .....

Related Article

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.