Topic locked

How do I fix my compile or runtime errors

April 9, 2013 - 2:14am #1

 

The general procedure on how to build and run a Vuforia sample app is described in this page:

https://developer.vuforia.com/resources/dev-guide/step-3-compiling-running-vuforia-sample-app

If after reading the developer guide, you are still facing compile or runtime errors, make sure to check the issues below.

 

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: …

or if you the error message indicates that some libraries are missing, like in this message:

the library libQCAR.so could not be loaded

those error messages typically indicate that you have not built the native (C++) part of your Android project; to fix the issue you can open a command console (e.g. cygwin), change directory to your project root and type:

ndk-build

After ndk-build has successfully built the native code, 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.

Note:

in case you renamed the Java package and/or class names, you might get an UnsatisfiedLinkError due to the fact that you did not rename the C++ native functions accordingly; for instance, if your package name is:

com.my.company.ImageTargets (instead of com.qualcomm.QCARSamples.ImageTargets);

and your main Java class is called:

com.my.company.ImageTargets.ImageTargets  (instead ofcom.qualcomm.QCARSamples.ImageTargets.ImageTargets),

then the native functions will have to be renamed like in this example:

Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargets_initApplicationNative

must be renamed to:

Java_com_my_company_ImageTargets_ImageTargets_initApplicationNative

Then, as usual, remember to run ndk-build again and refresh the Java project in Eclipse.

 

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 Exportand 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