maximus
maximus

Reputation: 4302

Imported android project to Eclipse: Cant compile

I have imported a project to Eclipse. The version of the API was 15 and it compiled successfully, but I needed 7th because on my phone the OS cannot be updated. After changing the version of the Android API to older one (7th) I can't compile the project, the follwing errors occures:

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;

It says R cannot be resolved to a variable:

setContentView(R.layout.main); 

And in main.xml

android:layout_width="match_parent"

it says: String types not allowed (at 'layout_width' with value 'match_parent').

Is it possible to resolve this errors, but still using the old API version?

Upvotes: 0

Views: 1275

Answers (3)

Hauke Ingmar Schmidt
Hauke Ingmar Schmidt

Reputation: 11607

If you need the USB functionality: No. It exists since API level 12.

Upvotes: 1

Sebastian Breit
Sebastian Breit

Reputation: 6159

You have to compile your project with the latest Android Api. Project Properties -> Android -> Android 4.0

In the manifest, you can set the

<uses-sdk android:minSdkVersion="7" />

If you are not using any library or new feature, it should work.

Upvotes: 1

Thiru VT
Thiru VT

Reputation: 831

Add the Jar of API 15 from platforms folder and include in Android MAnifesh as Android minsdk as 9 and target sdk as 15 then i hope your app will run

Upvotes: 0

Related Questions