Error: conversion to Dalvik format failed with error 1 solution.

Source: Internet
Author: User

Occasionally, after enabling eclipse, you may encounter the following error: conversion to Dalvik format failed with error 1. The solution to this problem is also scrawled: After you find an invalid method from the Internet, create a new project immediately, right-click the data in the problematic project and copy it to a new project, "Config build path... -> Add external jars... "The problem is solved, but I think it is complicated.

Today I encountered this problem again. I sought some ways to improve efficiency from the internet. I tried it one by one and finally solved the problem in a non-tedious way.

A single solution is transferred from the blog ramond007. The following is a summary of the solutions to this problem:



1. Check whether Android. jar is loaded. If not, add it using the following method:

(1) Right-click the project and choose build path> config build path...> JAVA build path> Add external jars> Android. jar.

(2) Right-click the project and choose Properties> JAVA build path> Add external jars> Android. jar.

(3) choose Project> Properties> JAVA build path> Add external jars> Android. jar from the menu bar.

After loading Android. jar in one of the three methods above, check whether the project has eliminated the error. If not, use solution 2.

2. In the dialog box "properties for % project name %" ("right-click a project-> Properties" or "menu bar project-> Properties, select the android tag on the left, select the corresponding version of the jar package added in the Project Build target on the right, check is library in the library, and check whether the project has eliminated the error, if not, use solution 3.

3. Create a new project, copy data from the original project to the new project, and configure the SDK.

Note: because the problem I encountered has been solved through solution 2, and new errors cannot be tested for the time being, the test sequence of solution 4 and solution 5 is not determined. Please give it a try.


4. Modify the project classpath file and change the content <classpathentry kind = "lib" Path = "Custom jar address"/> to <classpath
Entry kind = "con" Path = "com. Android. Ide. Eclipse. ADT. android_framework"/>.

Note: The classpath file is in the root directory of the corresponding project in the eclipse workspace (open through the file browser ).


5. If the android earlier version Project (such as 1.5) is put into a later version environment (such as 2.2), the preceding error may occur. The solution is as follows:

(1) If the android SDK version is not modified, use the Project Clean command to act on a project. (This processing method is only compatible with lower-version projects in the high version and is not actually upgraded .)

(2) to modify the android SDK version, perform the following steps:

First, modify the SDK.

Select the project, build path --> Configure build path ---> library to delete the referenced low-version SDK, add external jars, and select high-version SDK.

Second, modify the classpath file.

This file may contain this item: <classpathentry kind = "lib" Path = "Your specified High Version address", change it to <classpathentry
Kind = "con" Path = "com. Android. Ide. Eclipse. ADT. android_framework"
/>.

Third, modify androidmanifest. xml.

In the androidmanifest. xml file, add <uses-SDK Android: minsdkversion = "3"> </uses-SDK> to the application tag.
Fourth, modify default. properties (important ).

Target = Android-3 in the last line of the file (not used in the previous step) to target = Android-8.
Let's take a look at your project and the newly created android
2.2 of the project structure is the same.

The above are five solutions to this problem. If you cannot solve your problem and find a new effective solution to this problem, please leave a message for me, I will add a new solution.

Note: If the following error occurs: "cocould
Not find *. APK !", Remove the is library box selected in solution 2.

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.