初学android, 遇到了一下问题:
问题1:
下面代码中的第12行出错:R.layout.main cannot be resolved.
1 package com.Tealc.DaysBetween; 2 3 import android.R; 4 import android.app.Activity; 5 import android.os.Bundle; 6 7 public class DaysBetween extends Activity { 8 /** Called when the activity is first created. */ 9 @Override10 public void onCreate(Bundle savedInstanceState) {11 super.onCreate(savedInstanceState);12 setContentView(R.layout.main);13 }14 }
解决方案:(1) 删除第3行的 "import android.R;".(2) 勾选上Eclipse中的"Project->Build Automatically";
原因分析:(1) 删除"import android.R"之后工程就是从/res文件夹下自动生成的资源文件里去解析了,否则它会从Android的资源类里去找。(2) 动态构建"Build Automatically",自动发布最新的修改。
问题2:
WARNING: Application does not specify an API level requirement!原因:创建项目时没有指定Min SDK Version: 解决办法:在manifest.xml中加上<uses-sdk android:minSdkVersion="8"></uses-sdk>
c Client valuel leadership by examplei integrity & transparencyf fairness e excellence
问题3:
点击 mail.xml时, eclipse 故障退出在eclipse 的解压目录下, 的hs_err_pid****.log 记录了:# An unexpected error has been detected by HotSpot Virtual Machine:# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d2c2203, pid=3824, tid=2548# Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode)# Problematic frame:# C [fontmanager.dll+0x12203]
原因:fontmanager.dll, 过期,解决办法: 更新java runtime,