The import android.nfc.INfcSecureElement cannot be resolved - android

I got some sample code for android.nfc.NfcSecureElement but it throws some error.
The import android.nfc.INfcSecureElement cannot be resolved
Any suggestion how I can overcome this. Thanks.

The NFC API was added in API level 9, so ensure that your project utilizes the level 9 platform in your Project => Android => Project Build Target.

Related

Can not resolve symbol error in import statements in Android Studio Project

android studio code screeshot
Some Android imports are showing...Cant resolve symbol. even though those classes are available in SDK/Sources/...|(Red color code in picture)
Did you setup support library?
I think this is similar question.
You must setup support library same version of your project SDK version.
(ex. Android SDK version is 22, you must import com.android.support:appcompat-v7:22.+)

Cannot create android project compile with older API (like API 17)

Why I can only create android project that compile with API 21 or API 22? other than this 2, all will have error with R cannot be resolved, and if I import android.R, it will give me another error which is activity_main cannot be resolved or is not a field. I search for solution from Google but all doesn't work for me. Help me please.
and here is the error if I import android.R
and if I change to avtivity_list_item there still have error.
Well for the first error:
check your SDK Manager to see if you have the the 4.2.2(API 17) installed.
And for the second:
I had this problem sometime ago, all you have to do is clean your project and build it again as this answer suggests link, see if that helps.

android.app.ActionBar class not being recognized

The problem i'm facing right now is Android Studio doesn't recognize import classes api level 11 and above. And in manifest the minsdk version i'm using is 14, this is fustrating. I'm trying to import android.app.ActionBar but i can't, i was going to use support library but there's no sense if i'm using api level 14.
Thanks.
I resolved it modyfing the build.gradle in the section {android,defaultConfig} :-)

Compilation Error in Android Api sample applicaiton after import into eclipse

I have imported the android api sample applicaition into Eclipse. I am getting compile error in import and where ever this R is used. Api levels are fine, I couldnt see R.class is getting generated. Please spot my prob and help me out fix this.
`import com.example.android.apis.R;`
clean the project(go to project->clean)...if not solved
manually add the library(right click project->properties-->search for 'java build path)
I finally debugged why this hasn't been building. (I had it running in older SDKs.)
After trying the various suggestions here to no avail, I found that the project is missing the accessibility_node_provider_instructions string resource from res/values/strings.xml. Plus it also needed the android-support-v4.jar library for PrintBitmap.java.
This is with Android 4.4.2 (API 19).
Check if the package name in the manifest tag of AndroidManifest.xml is correct com.example.android.apis
If you have created the api samples project via. eclipse -> New ->Android Sample Project you should not have any project with package.
The jre system libray was not added in the project, once added the issue get resolved.

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?
If you need the USB functionality: No. It exists since API level 12.
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.
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

Categories

Resources