【发布时间】:2012-05-21 12:33:58
【问题描述】:
我已将一个项目导入 Eclipse。 API 的版本是 15 并且编译成功,但我需要第 7 版,因为在我的手机上无法更新操作系统。将 Android API 的版本更改为旧版本(第 7 版)后,我无法编译项目,出现以下错误:
import android.hardware.usb.UsbConstants;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface;
import android.hardware.usb.UsbManager;
它说 R 不能被解析为一个变量:
setContentView(R.layout.main);
在 main.xml 中
android:layout_width="match_parent"
它说:不允许使用字符串类型(在“layout_width”处,值为“match_parent”)。
是否可以解决此错误,但仍使用旧 API 版本?
【问题讨论】:
标签: android eclipse compiler-errors