Android-solutions to common errors

Source: Internet
Author: User

Here are some solutions to common errors I encountered when using Android. Some solutions are also found online, and I have sorted them out and collected them. It will also be updated in the future to add problems encountered in use.

Today, I downloaded several Android source codes from the Internet and imported them using eclipse. the following error is returned:

1. The error "the type java. Lang. object cannot be resolved. It is indirectly referenced from required. class files" is displayed.

Cause: the JDK location cannot be found or the JDK location is not set.

Solution:

1) In package Explorer-> Project-> properties-> JAVA bulid path
2) Select "add library ..."
3) Select "JRE system library" and press next.
4.) Select workplace default JRE and press finish...

Note: The JRE system library is generally stored in \ android_sdks \ platforms \ Android-9 \ android. jar. The first directory is the path you selected when installing JRE. Different computers may be different.

2. The error "the import Android cannot be resolved" occurs.

Cause: the android SDK cannot be found.

Solution:

In package explorer> Project> Properties> Android, select the corresponding SDK in Project Build target.

3. appeared: Android requires compiler compliance level 5.0 or 6.0. Found '1. 5' instead. Please fix Project Properties

Cause: some files in the project have not been modified.

Solution:

Project-> Android tools-> fix Project

4. Conversion to Dalvik format failed with error 1

Find the following solution on the Internet:

If an android earlier version Project (such as Android 1.5) is placed in a later version environment (such as Android 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 truly upgraded)
(2) If you modify the android SDK version, you need to perform the following steps:
1) modify the SDK
Select the project, build path --> Configure build path ---> library to delete the referenced low-version SDK,
Add external jars, select SDK of later version, OK, and save
2) modify the classpath File
This file may contain this item: <classpathentry kind = "lib" Path = "Your specified High Version address"
Change her to <classpathentry kind = "con" Path = "com. Android. Ide. Eclipse. ADT. android_framework"/>

Note: The classpath file is not loaded into the Eclipse project. It stores the path in the root directory of the project, you need to find the file on the hard disk and use NotePad to open it and then modify it.
3) Modify androidmanifest. xml
In the androidmanifest. xml file, add the <uses-SDK Android: minsdkversion = "3"> </uses-SDK>
4) Modify default. properties (important)
Target = Android-3 in the last line of the file (not used in the previous step), and save it as target = Android-8.
Let's take a look at your project and the new Android 2.2 project structure.

However, the problem still persists here. The problem still lies in the inconsistency of the SDK version. I used the second method and deleted the irrelevant SDK library to solve the problem.

5. unhandled exception type ioexception:

Cause: unprocessed ioexception type

Solution: avoid or catch this exception. Modify as follows:

        try{                txt.setText(getRawString().toString());        }        catch(Exception e){               e.printStackTrace();                   }  

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.