Possible causes of errors in importing Android projects to eclipse

Source: Internet
Author: User

Possible causes of errors in importing Android projects to eclipse
There are basically four types:
① Adk version: --- API level ing (note that the higher version is not necessarily compatible with the lower version)
Android 2.3.4 --- 10
Android 2.3.1 --- 9 === gingerbread
Android 2.2 --- 8 === froyo
Android 2.1 --- 7 === eclair
Android 2.0.1 --- 6 === eclair
Android 2.0 --- 5 === eclair
Android 1.6 --- 4 === donut
Android 1.5 --- 3 === cupcak
Android 1.1 --- 2
Android 1.0 --- 1
========> 1. target = Android-5 is changed to 8 or higher. 2. right-click the project to open project properties, select android on the left, and select a specific Android version on the right.
Right-click the project and choose "Fix Project Properties" under "android Tools". 3. If no default properties exists, create the project by yourself, and then target = Android-10

② JDK version:
1.5 only child classes that inherit the class can be overwritten with @ Overwrite
1.6 @ Overwrite

========>
Window --> preferences --> JAVA --> compliance --> compiler on the right, select 1.6 or another, click Apply, and click OK. (1.6 downward compatible)

③ Add additional library support

========>

First, add the Android. jar package, right-click the project
Buildpath,

Java buildpath, select Libraries

Click "addlibrary" in the button on the right"

Select "userlibrary" and click "Next"

Click "userlibrarys ".

On the displayed page, click "new ...".

In the pop-up interface, enter a name and click "OK"

Click "addjars" to select a third-party jar package and click "OK" to complete the operation.

④ Tool problems ADT, JDK, and eclipse

Q: When I import a project from another user or copy a file to eclipse, I will not import this package for Android *. *. How can I import it ????????
Right-click the project -- Build path -- add library -- select Android classpath container -- click Next and finish.

Solution to Chinese garbled characters in eclipse

The reason why eclipse encounters garbled characters is that the encoding rules selected by the eclipse editor are variable. Generally, the default is UTF-8 or GBK, when an external import project, if the project encoding method and eclipse set the encoding method is different, it will produce Chinese garbled problem, there are several other cases.

If the encoding method of the imported project conflicts with that of Eclipse, all Chinese characters in this project are garbled; if the encoding methods of all projects conflict with those of the eclipse workspace, the Chinese characters in all projects may be garbled. For the eclipse workspace, eclipse saves your modified settings in the workspace settings file and modifies the encoding mode of a single project, eclipse will save the encoding method in the project. setting file package.

Therefore, there are two principles to avoid Chinese Garbled text:

(1) To avoid frequent changes to the workspace, it is recommended that the project be carried out in a workspace from the very beginning, in addition, it is best to set the encoding method of the workspace as the most frequently used or the project encoding method prescribed by the company, so that the project will use the encoding method of the workspace, avoid inconsistent codes;

(2) try to use the same encoding method for files of the same type to ensure that all files of the same type can use consistent encoding settings;

To solve Chinese Garbled text, you can set the following solutions:

(1) modify the workspace encoding method:

Window-> preferences-> General-> Workspace-> text file encoding

.

In others, select the desired encoding method and save it.

(2) modify the coding method of a single project:

Right-click the project and choose Properties From the shortcut menu"

.

Select Info (the first one) in the menu tree on the left of the new window, find text file encoding on the right, select "other", and select the encoding method in the drop-down box.

.

(3) modify the encoding method of a class of files:

If you want to set the JS file encoding method to UTF-8, you should

Window-> General-> content types

.

In content types, select JavaScript source file, select *. js in the file associations column, enter the UTF-8 in the default encoding column, click Update, and save.

(4) modify the encoding method of a single file: Right-click the file to be modified and select the last "properties" in the pop-up menu ", select Info (the first one) in the menu tree on the left of the new window, find text file encoding on the right, select "other", and select the encoding method in the drop-down box. This method is similar to modifying the engineering coding method.

PS: Another garbled problem encountered during the project is the font file of the operating system. In some cases, if the Chinese font of the system used by eclipse is damaged, it also causes the problem that Chinese characters cannot be displayed. Therefore, if the above settings cannot solve the problem, you should consider the problem of system font files.

Reprinted: http://lilin530.iteye.com/blog/1768261

Chinese garbled because the project code is UTF-8, mostly in Linux or Ubuntu using UTF-8, in win is GBK encoding, Chinese garbled code in the Code, set the project encoding format, OK ,.

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.