When I used Eclipse to develop an Android applet, I encountered some minor problems. during the course of learning, I recorded the problems I encountered, which were quite complicated and related to program errors, for linux applications, see eclipse settings ~ When I used Eclipse to develop an Android applet, I encountered some minor problems. during the course of learning, I recorded the problems I encountered, which were quite complicated and related to program errors, for linux applications, see eclipse settings ~
1. ERROR: Application requires API version 10. Device API version is 8Solution: modify two configuration files. 1: In AndroidManifest. xml, Find this line, which indicates the minimum version required by the application, and change the number to the version above the die generator. (Device API) 2: in default. properties, set target = android-8 to the version of the simulator to run. (Application requires API)
2. Android requires compiler compliance level 5.0. Please fix project properties. ErrorSolution: 1. right-click the Project and choose android tools> Fix Project 2. if not, check Project-> Properties-> Java Compiler to confirm that JDK compliance is set to 1.6 and enable specific seetings.
3. in the downloaded. java file, the comments are basically Chinese, and the Chinese characters in linux are garbled.In windows, the Chinese encoding is generally gbk, while in linux, the Chinese encoding is generally utf8, so the files normally opened in windows may be garbled in linux. Solution: Use the iconv command to convert the file content encoding. For example, I have a file named "common linux commands" which can be opened normally in windows, but garbled characters may occur when opened in linux. enter the following code on the terminal: iconv-f gbk-t utf8 linux common command .txt> linux common command _cn.txt and then open the file "linux _cn.txt". the file garbled problem is solved.
4. display row numbers using exlipseSolution: 1. ctrl + f10 display menu, check the show line number option; 2. right-click the leftmost part of the code editing area (that is, the row number position should be displayed) and the shortcut menu appears, for example, solution 1; 3. click Window (or right-click in the code editing area)-> Preferences-> Gerenal-> Editors-> Text Editors, and then sign the show line number check box.
5. install eclipse and java jdk environment variable settings in windows
1. eclipsewww.eclipse.org/downloads/, find the download file that matches your system, and then decompress it.
Java jdkwww.oracle.com/technetwork/java/javase/downloads/index.html
2. java jdk environment variable configuration: to put it simply, you need to set path and classpath. The path is to add bin, and the classpath is lib.
My computer-> Properties-> Advanced system configuration.
1) there is a path in the system. you only need to add the bin address to it. separate the paths.
Example: C: \ Program Files \ Java \ jdk1.6.0 \ bin
2) you must create a classpath by yourself. of course, if you already have a classpath, you can edit it in it. Note that the classpath must be prefixed with "..", which indicates the current path.
Example:.; C: \ Program Files \ Java \ jdk1.6.0 \ lib \ dt. jar; C: \ Program Files \ Java \ jdk1.6.0 \ lib \ tools. jar
3) to facilitate writing and subsequent changes, you can set the java_home variable to C: \ Program Files \ Java \ jdk1.6.0, in this way, % java_home % can be used in path and classpath to replace C: \ Program Files \ Java \ jdk1.6.0
For example, you can set path to % java_home % \ bin.
6. configure the environment and run eclipse. the error "Failed to load the JNI shared library jvm. dll" occurs.
Solution: windows is 64-bit and eclipse is 64-bit, but the java sdk is 32-bit, which makes a mistake... Change to 64-bit ~
7. ANT environment variable settings
In Windows, ANT mainly uses two environment variables: ANT_HOME and PATH.
Set ANT_HOME to point to the ant installation directory.
Setting method: ANT_HOME = D: \ apache_ant_1.7.0
Add % ANT_HOME % \ bin; % ANT_HOME % \ lib to the path of the environment variable.
Setting method: PATH = % ANT_HOME % \ bin; % ANT_HOME % \ lib
8. Expected to find it in D: \ jre6 \ lib \ tools. jar
The command line prompts "Unable to locate tools. jar. expected to find it in C: \ Program Files \ Java \ jre6 \ lib \ tools. jar "; the ANT_HOME environment variable has been configured. Solution: Set tools under the" C: \ Program Files \ Java \ jdk1.6.0 _ 16 \ lib "directory. copy the jar file to the "C: \ Program Files \ Java \ jre6 \ lib" directory and run the ant command again. The problem is solved.
9. Test run failed: Instrumentation run failed due to 'Java. lang. ClassNotFoundException'
JUnit is not introduced. check whether JUnit is checked in the configuration.Project -> Properties -> Java Build Path -> Order and Export
And check JUnit if it is unchecked.
10. Test run failed: Instrumentation run failed due to 'Java. lang. classcastexception'
Delete the package, delete both the development project package and test package, and reinstall it !!!
11. after ADT and Android SDK are installed, there are no icons for Android SDK Manager and Android virtual Device Manager.
Eclipse-> window-> customize Perpective-> Command Groups Availability check andorid option
12. error: Error: No resource found that matches the given name (at 'background' with value' @ drawable/btn_title_back_big ').
An error occurred while displaying all the resource files. right-click the console location and select preferences to add 0 to the buffer size of the console, you can see which resource file has an error. modify it.
The above is a summary of 12 errors in the development of Android applets in Eclipse. For more information, see other related articles in the first PHP community!