Android - How do I fix my compile or runtime errors

February 25, 2013 - 6:51am #1

 

UnsatisfiedLinkError

If you observe runtime errors where the message indicates that some links are unresolved (similar to the one reported here below):

02-25 15:00:48.270: E/AndroidRuntime(31474): java.lang.UnsatisfiedLinkError: …

this often indicates that you have not built the native (C++) part of your Android project; to fix the issue you can open a command console, change directory to your project root and type:

ndk-build

After ndk-build has successfully run, you should see the \libs folder appearing under your project directory; in Eclipse, make sure to refresh your project (right-click on the project and select Refresh or simply press F5) and then run the app again.

 

Could not find method

If you get a runtime error with a message similar to the following:

unable to resolve static method XY: …

or similar to the following:

Could not find method com.qualcomm.QCAR.QCAR.someMethod…

The problem might be with your QCAR_SDK_ROOT variable; in this case you need to verify whether your QCAR_SDK_ROOT has been defined and whether it is pointing to the correct path (for instance, if you upgrade to a newer version of the Vuforia SDK, the QCAR_SDK_ROOT might still point to an older version, such as V1.5).

To verify this (in Eclipse), open the Window menu and select Preferences / Java / Build Path / Classpath Variables; you should see a list of symbols, including QCAR_SDK_ROOT; if you don’t see it, add it to the list and set its value to the path of your Vuforia library (for instance “C:\Development\Android\vuforia-sdk-2-0-30\”); if it is already defined, make sure that the path corresponds to the actual location of your latest Vuforia installation directory.

Another possible cause could be that the QCAR jar file is not exported with your APK when the app is deployed on your device; to enforce that, right-click on your project, select Properties / Java Build Path / Order and Export and make sure to check (tick) the checkbox for QCAR_SDK_ROOT; then press Apply/OK and clean/rebuild the project.

 

Compliance level

If you get the following error message upon importing a Vuforia sample project into Eclipse:

Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.

you can fix this by simply right-clicking the project, and selecting Android Tools -> Fix Project Properties.

 

No matching EGL configs

If you get an error with the following (or similar) message:

02-11 08:56:29.312: E/AndroidRuntime(878): FATAL EXCEPTION: GLThread 83

02-11 08:56:29.312: E/AndroidRuntime(878): java.lang.IllegalArgumentException: No matching EGL configs

 

the most likely reason for such error is that you are trying to run a Vuforia application on the Android emulator (on a “virtual device”); Vuforia requires a real device, it cannot be run on the Android emulator.

 

 

Topic locked