Android Development experience Sharing (2) beginners often encounter problems to organize

Source: Internet
Author: User

In the process of learning encountered a lot of problems, fortunately, the end of the Internet query has been resolved. Now I am learning the Android development process encountered some problems and solve the following methods.

1.r.java cannot be updated in real time

Problem Description: The new variable in the Res file cannot be displayed in real time in R.java.

Workaround: Select "Project" in the menu bar and tick the "Build automatically" option.

2.LogCat window not showing

Problem Description: The Logcat window is not displayed at the bottom right of eclipse.

Workaround: Select Windows on the menu bar, select Show View, and then select LogCat.

3. Compile-time Prompt "Android library projects cannot be launched" error workaround

Problem Description: Compile-time Prompt "Android library projects cannot be launched" error

Workaround: Select "Project" in the menu bar, then "Properties" and select "Android" in the popup window to remove the check in front of the IS library option.

4. After adding the EditText control in XML Prompt "This text field does not specify an inputtype or a hint" error

Problem Description: Add the EditText control to the XML, and the control information is as follows.

<edittext

Android:id= "@+id/edittext"

Android:layout_width= "Match_parent"

android:layout_height= "Wrap_content" ></EditText>

At compile time, prompt "This text field does not specify an inputtype or a hint" error.

Cause analysis: Android:hint and android:inputtype information are missing from the control. The android:hint is used to set the default text hint information displayed when EditText is empty. Android:inputtype the type of text used to set EditText to help the input method display the appropriate keyboard type.

Workaround: Add android:hint and Android:inputtype information to the control, and the added control information is as follows.

<edittext

Android:id= "@+id/edittext"

android:hint= "0"

Android:inputtype= "Number"

Android:layout_width= "Match_parent"

android:layout_height= "Wrap_content" ></EditText>

5. Warning message "hardcoded string" xxx ", should use @string resource" method of elimination

Problem Description: Add a button control to the XML, and the control information is as follows.

<button

Android:id= "@+id/mbutton_mc"

Android:text= "MC"

Android:layout_width= "Match_parent"

android:layout_height= "Wrap_content" >

</Button>

At compile time, prompt "hardcoded string" MC, should use @string resource "warning.

Cause analysis: Using the string MC in Android:text, you should define the string in String.xml and then use that string resource by calling the resource name of the string in String.xml. The advantage of this is that it can be changed completely and is useful in supporting multiple languages.

Workaround: Add the string MC information in the Res-->values-->string.xml under the project directory as follows.

<resources>

<string name= "MC" >mc</string>

</resources>

Then, in the XML that uses the button control, the string is used by invoking the string's resource name, as follows.

<button

Android:id= "@+id/mbutton_mc"

android:text= "@string/MC"

Android:layout_width= "Match_parent"

android:layout_height= "Wrap_content" >

</Button>

6. Warning message "Nested weights is bad for performance" elimination method

Cause Analysis: When the layout is nested, the parent and child layouts use android:layout_weight, but not when they must be used, the warning message shown title appears.

Workaround: According to the actual situation, remove the android:layout_weight that must be used in the sub-layout.

7. Error message when you start the emulator "Please ensure this adb is correctly located at:xxxxx" workaround

Symptom: Using the correct source code, the following error message appears when you start the emulator "Please ensure this adb is correctly located at ' D:\AndroidSDK4.0\android-sdk-windows\ Platform-tools\adb.exe ' and can be executed. "

Workaround: Add D:\AndroidSDK4.0\android-sdk-windows\platform-tools to the system environment variable path.

8. The simulator always displays the message "Waiting for HOME (' Android.process.acore ') to be launched ..." solution

Phenomenon: When the simulator starts, wait for a long time (more than 5 minutes) also can not start, has been prompted "waiting for HOME (' Android.process.acore ') to be launched ..." information.

WORKAROUND: Delete the current emulator and recreate the emulator.

9.Android Simulator horizontal screen and vertical screen switch

After the simulator starts, check the simulator and press CTRL+F11 to switch between the Android simulator horizontal screen and the vertical screen.

10. Imported Android Project @override error

Phenomenon: When the source of Android project downloaded from the Internet is imported into Eclipse, @Override error.

Solution: In the error project, the right mouse button selection Properties-->java Compiler-->compiler compliance level Select 1.6, refresh the project, will not error.

Android Development experience Sharing (2) beginners often encounter problems to organize

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.