Forum / MIFARE SDK / Lite Sample Application
-
What is the SDK Lite sample app supposed to do anyways? I am trying to get the Eclipse project working and installed on a phone (Samsung Galaxy Nexus and Samsung Galaxy S4) but when it runs it gets an error, "Unfortunately, Sample App MIFARE SDK Lite has stopped" The LogCat is below. I think the issue is that if I go to the Project Properties and under Android > Library section it can't find "..\NxpNfcLib". I don't know where to find that. I added the "nxpnfcliblite.jar" file to the project like the User Manual stated to do, so I am not sure what I am missing. Thanks.
06-09 20:30:08.179: D/dalvikvm(14982): Late-enabling CheckJNI
06-09 20:30:08.452: D/dalvikvm(14982): GC_FOR_ALLOC freed 64K, 2% free 8665K/8756K, paused 23ms, total 24ms
06-09 20:30:08.460: I/dalvikvm-heap(14982): Grow heap (frag case) to 13.756MB for 5526584-byte allocation
06-09 20:30:08.577: D/dalvikvm(14982): GC_FOR_ALLOC freed <1K, 1% free 14061K/14156K, paused 113ms, total 113ms
06-09 20:30:08.608: D/dalvikvm(14982): GC_CONCURRENT freed 1K, 1% free 14065K/14156K, paused 3ms+13ms, total 32ms
06-09 20:30:08.663: D/libEGL(14982): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
06-09 20:30:08.679: D/libEGL(14982): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
06-09 20:30:08.687: D/libEGL(14982): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
06-09 20:30:08.772: D/OpenGLRenderer(14982): Enabling debug mode 0
06-09 20:30:10.882: I/dalvikvm(14982): Could not find method com.nxp.nfclib.plus.PlusSL1.getCardDetails, referenced from method com.nxp.sampleliblite.MainLiteActivity.PlusSL1CardLogic
06-09 20:30:10.882: W/dalvikvm(14982): VFY: unable to resolve virtual method 4705: Lcom/nxp/nfclib/plus/PlusSL1;.getCardDetails ()Lcom/nxp/nfclib/classic/MFClassic$CardDetails;
06-09 20:30:10.882: D/dalvikvm(14982): VFY: replacing opcode 0x6e at 0x0016
06-09 20:30:10.882: W/dalvikvm(14982): VFY: unable to resolve exception class 646 (Lcom/nxp/nfclib/exceptions/SmartCardException;)
06-09 20:30:10.882: W/dalvikvm(14982): VFY: unable to find exception handler at addr 0x72
06-09 20:30:10.882: W/dalvikvm(14982): VFY: rejected Lcom/nxp/sampleliblite/MainLiteActivity;.PlusSL1CardLogic ()V
06-09 20:30:10.882: W/dalvikvm(14982): VFY: rejecting opcode 0x0d at 0x0072
06-09 20:30:10.882: W/dalvikvm(14982): VFY: rejected Lcom/nxp/sampleliblite/MainLiteActivity;.PlusSL1CardLogic ()V
06-09 20:30:10.882: W/dalvikvm(14982): Verifier rejected class Lcom/nxp/sampleliblite/MainLiteActivity;
06-09 20:30:10.882: W/dalvikvm(14982): Class init failed in newInstance call (Lcom/nxp/sampleliblite/MainLiteActivity;)
06-09 20:30:10.882: D/AndroidRuntime(14982): Shutting down VM
06-09 20:30:10.882: W/dalvikvm(14982): threadid=1: thread exiting with uncaught exception (group=0x41597930)
06-09 20:30:10.890: E/AndroidRuntime(14982): FATAL EXCEPTION: main
06-09 20:30:10.890: E/AndroidRuntime(14982): java.lang.VerifyError: com/nxp/sampleliblite/MainLiteActivity
06-09 20:30:10.890: E/AndroidRuntime(14982): at java.lang.Class.newInstanceImpl(Native Method)
06-09 20:30:10.890: E/AndroidRuntime(14982): at java.lang.Class.newInstance(Class.java:1319)
06-09 20:30:10.890: E/AndroidRuntime(14982): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
06-09 20:30:10.890: E/AndroidRuntime(14982): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
06-09 20:30:10.890: E/AndroidRuntime(14982): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-09 20:30:10.890: E/AndroidRuntime(14982): at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-09 20:30:10.890: E/AndroidRuntime(14982): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-09 20:30:10.890: E/AndroidRuntime(14982): at android.os.Handler.dispatchMessage(Handler.java:99)
06-09 20:30:10.890: E/AndroidRuntime(14982): at android.os.Looper.loop(Looper.java:137)
06-09 20:30:10.890: E/AndroidRuntime(14982): at android.app.ActivityThread.main(ActivityThread.java:5041)
06-09 20:30:10.890: E/AndroidRuntime(14982): at java.lang.reflect.Method.invokeNative(Native Method)
06-09 20:30:10.890: E/AndroidRuntime(14982): at java.lang.reflect.Method.invoke(Method.java:511)
06-09 20:30:10.890: E/AndroidRuntime(14982): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-09 20:30:10.890: E/AndroidRuntime(14982): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-09 20:30:10.890: E/AndroidRuntime(14982): at dalvik.system.NativeStart.main(Native Method)
06-09 20:46:17.187: D/dalvikvm(15225): GC_FOR_ALLOC freed 46K, 1% free 8665K/8740K, paused 15ms, total 16ms
06-09 20:46:17.210: I/dalvikvm-heap(15225): Grow heap (frag case) to 13.756MB for 5526584-byte allocation
06-09 20:46:17.226: D/dalvikvm(15225): GC_FOR_ALLOC freed <1K, 1% free 14061K/14140K, paused 18ms, total 18ms
06-09 20:46:17.241: D/dalvikvm(15225): GC_CONCURRENT freed <1K, 1% free 14061K/14140K, paused 3ms+3ms, total 18ms
06-09 20:46:17.296: D/libEGL(15225): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
06-09 20:46:17.319: D/libEGL(15225): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
06-09 20:46:17.319: D/libEGL(15225): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
06-09 20:46:17.397: D/OpenGLRenderer(15225): Enabling debug mode 0
06-09 20:46:19.405: I/dalvikvm(15225): Could not find method com.nxp.nfclib.plus.PlusSL1.getCardDetails, referenced from method com.nxp.sampleliblite.MainLiteActivity.PlusSL1CardLogic
06-09 20:46:19.405: W/dalvikvm(15225): VFY: unable to resolve virtual method 4705: Lcom/nxp/nfclib/plus/PlusSL1;.getCardDetails ()Lcom/nxp/nfclib/classic/MFClassic$CardDetails;
06-09 20:46:19.405: D/dalvikvm(15225): VFY: replacing opcode 0x6e at 0x0016
06-09 20:46:19.405: W/dalvikvm(15225): VFY: unable to resolve exception class 646 (Lcom/nxp/nfclib/exceptions/SmartCardException;)
06-09 20:46:19.405: W/dalvikvm(15225): VFY: unable to find exception handler at addr 0x72
06-09 20:46:19.405: W/dalvikvm(15225): VFY: rejected Lcom/nxp/sampleliblite/MainLiteActivity;.PlusSL1CardLogic ()V
06-09 20:46:19.405: W/dalvikvm(15225): VFY: rejecting opcode 0x0d at 0x0072
06-09 20:46:19.405: W/dalvikvm(15225): VFY: rejected Lcom/nxp/sampleliblite/MainLiteActivity;.PlusSL1CardLogic ()V
06-09 20:46:19.405: W/dalvikvm(15225): Verifier rejected class Lcom/nxp/sampleliblite/MainLiteActivity;
06-09 20:46:19.405: W/dalvikvm(15225): Class init failed in newInstance call (Lcom/nxp/sampleliblite/MainLiteActivity;)
06-09 20:46:19.405: D/AndroidRuntime(15225): Shutting down VM
06-09 20:46:19.405: W/dalvikvm(15225): threadid=1: thread exiting with uncaught exception (group=0x41597930)
06-09 20:46:19.413: E/AndroidRuntime(15225): FATAL EXCEPTION: main
06-09 20:46:19.413: E/AndroidRuntime(15225): java.lang.VerifyError: com/nxp/sampleliblite/MainLiteActivity
06-09 20:46:19.413: E/AndroidRuntime(15225): at java.lang.Class.newInstanceImpl(Native Method)
06-09 20:46:19.413: E/AndroidRuntime(15225): at java.lang.Class.newInstance(Class.java:1319)
06-09 20:46:19.413: E/AndroidRuntime(15225): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
06-09 20:46:19.413: E/AndroidRuntime(15225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
06-09 20:46:19.413: E/AndroidRuntime(15225): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-09 20:46:19.413: E/AndroidRuntime(15225): at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-09 20:46:19.413: E/AndroidRuntime(15225): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-09 20:46:19.413: E/AndroidRuntime(15225): at android.os.Handler.dispatchMessage(Handler.java:99)
06-09 20:46:19.413: E/AndroidRuntime(15225): at android.os.Looper.loop(Looper.java:137)
06-09 20:46:19.413: E/AndroidRuntime(15225): at android.app.ActivityThread.main(ActivityThread.java:5041)
06-09 20:46:19.413: E/AndroidRuntime(15225): at java.lang.reflect.Method.invokeNative(Native Method)
06-09 20:46:19.413: E/AndroidRuntime(15225): at java.lang.reflect.Method.invoke(Method.java:511)
06-09 20:46:19.413: E/AndroidRuntime(15225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-09 20:46:19.413: E/AndroidRuntime(15225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-09 20:46:19.413: E/AndroidRuntime(15225): at dalvik.system.NativeStart.main(Native Method)
06-09 20:46:50.327: I/Process(15225): Sending signal. PID: 15225 SIG: 9
+ 0 | - 0
Are you sure that it says "NxpNfcLib" ? Because that is for Advanced Version, not LITE Version. Lite version has NxpNfcLiteLib
+ 0 | - 0
It definitely says "NxpNfcLib". I double checked I added the nxpnfcliblite.jar under Project Properties > Java Build Path > Libraries as well. Would you be able to tell me what this sample app is supposed to do anyways, if it was working?
+ 0 | - 0
Well it gives you some basic info about cards that you tap to your device that are supported by LITE Version (reading UID, NDEF, general info) etc.
It's more to check how to use the code to do some basic stuff with the SDK. As an introduction to the LITE SDK.
+ 0 | - 0
So I am not sure what library it is referring to since I added the correct jar that was referenced in the user manual and didn't mention a library in that section. Is there anything else that needs to be added?
On a different note can one use the MIFARE SDK to develop an android app that would act like the IC cards themselves to interact with separate hardware readers by NXP?
Thanks for the help.
+ 0 | - 0
To be honest, we haven't seen such report as yours, so it might be something on your site that you do wrong. If you follow the steps it should work like a charm.
What you could try is to restart your IDE and do a Clean Build / Sync files (don't know Eclipse, since I use Android Studio). If not, try to delete your App and start over with creating a new one following again the steps from User Manual. Be sure to read the LITE SDK User manual.
To your other question: No, you cannot. This is a different topic, it's called HCE (Host Card Emulation), but this is not part of the SDK. However, you could ask about it in our General Topic forums section, they might know how to help you further with that case.
Best,
David
+ 0 | - 0
I was just trying to use the sample app code that they provided and since the instructions used Eclipse that is what I did. I would be happy to do this within Android Studio. Would you be able to tell me how to properly import the sample project into Android Studio? I got errors trying to do that. Otherwise yes I was going to try and create the app from scratch in Eclipse. Thanks.
+ 0 | - 0
Yes,sure.
1. You have to copy the .jar file into your "
" folder inside your App Folder.libs
2. Then you do a
inside Android Studio.Clean Build
3. Then you have to open your
(Module App I think it is), and there you will see "dependencies" brackets.Gradle file
4. You have to add following line inside those brackets:compile files (“libs/nxpnfclib.jar”)
5. Now click on the button"Sync Project with Gradle Files"
6. If it still gives you some issues do another
."Clean Build"
Hope it will work.
David
+ 0 | - 0
So in order to import the Lite sample app into Android Studio I did the following:
1. Extracted the downloaded zip file containing the project
2. copied the "nxpnfcliblite.jar" into the libs dir: "MIFARE_SDK_lite3SampleApps\src\SampleNxpNfcLibLite\libs" as suggested above
3. Within Android Studio, I did: File > New > Import Project
4. Selected the project dir "SampleNxpNfcLibLite" and selected to have it imported into Android Studio workspace
5. On screen for "Import Project from ADT (Eclipse Android)", i have selected the following checked:
- Replace jars with dependencies, when possible
- Replace library sources with dependencies, when possible
- Create Gradle-style (camelCase) module names
6. Select Next and get the following warnings "Project SampleNxpNfcLibLite:C:\Users\alivick\Desktop\SampleNxpNfcLibLite\project.properties:
Library reference ..\NxpNfcLib could not be found
Path is C:\Users\alivick\Desktop\SampleNxpNfcLibLite\..\NxpNfcLib which resolves to C:\Users\alivick\Desktop\NxpNfcLib"
7. Select Finish and I get the following error "There are unrecoverable errors which must be corrected first"
8. Select OK and it just takes me back to the warning screen and doesn't import the project.
So is there some other means in which I am supposed to import the sample project into Android Studio?
+ 0 | - 0
Yes, I also have strange issues with importing Eclipse projects to Android Studio (not talking about this case, but in general some Eclipse Projects dont get well imported to Android studio).
Here is what I see as options that you could try out:
1. Try to move your Project somewhere else rather than Desktop. Maybe inside Documents or something like that.
2. Try to OPEN PROJECT, and not IMPORT PROJECT and then if no error, do the Gradle stuff that i explained in previous post.
3. Try to create a blank Android project and do the steps as I told you to do. Then try to manually re-create the MainActivity by copying the content of SampleLiteApp.
Best,
David
+ 0 | - 0
I still haven't got the SDK to run on a Samsun S6 with lollipop. I started playing around with programming and it never gets to the intent. I get no errors what so ever and I have fresh EV1 cards right from the manufacturer.
Here is the stub of code that I am using.
http://pastebin.com/ULKMizvi
Steve
+ 0 | - 0
From the quick overview of your code, I noticed you are not loading your KeySet from KeyFactory.
Please refer again to the User Manual where it is described.
Also please check that your AndroidManifest includes all the necessary permission and intent categories, in order to display new intent.
Best,
David
+ 0 | - 0
Ah, now I see, it is Lite SDK. So ignore the "KeySet" part from previous answer.
But do check for ANdroidManifest, if everything is in what is needed.
Also add the:
@Override
protected
void
onPause() {
libInstance
.stopForeGroundDispatch();
super
.onPause();
}
@Override
protected
void
onResume() {
libInstance
.startForeGroundDispatch();
super
.onResume();
}
I didnt notice it in your code.
Best,
David
+ 0 | - 0
David,
Thanks for the reply. The onpause and onresume are in there, I am not sure why it did not post. The manifest looks right to me, it is taken right from the lite sample app. I believe it is a problem with lollipop. I do not have another phone to try it on though.
Steve
+ 0 | - 0
-
AuthorPosts
You must be logged in to reply to this topic.