How To Migrate an Android Project

Use this article to understand the steps necessary to upgrade a project that uses the Vuforia Android SDK.  To upgrade a Unity based Android project, See: How to migrate a Unity project

To migrate a Vuforia 4 or 5 project to Vuforia 6 or later, you'll simply need to update the Vuforia Android SDK libraries in your project, See: Installing the Android SDK for Android Studio or Installing the Vuforia Android SDK for Eclipse if you are updating a legacy Vuforia Eclipse project. Also see: Changes in Vuforia 6

Note: Be sure to make a copy of your project before migrating

When migrating from Vuforia 3, you'll need to apply the following changes.

Upgrading a Vuforia 3 project to Vuforia 6

Refer to the new samples where all these changes have been incorporated. The following instructions are based on Vuforia samples and may vary depending on individual implementations.

Eclipse project settings

Update the QCAR_SDK_ROOT variable in your Eclipse project settings, by setting its value to the new path of your Vuforia SDK v3.0 installation.

In Eclipse, go to Window > Preferences > Java > Build Path > Classpath Variables, and update it to the path of the new Vuforia v3.0 .jar file, for example:

C:\Development\Android\vuforia-sdk-android-x-x-x\build\java\vuforia\Vuforia.jar

Note: For developers upgrading from 2.6, in version 2.8, the Vuforia Java library formerly called QCAR.jar was renamed to Vuforia.jar; similarly, the Vuforia native library was renamed from libQCAR.so to libVuforia.so; the latter is located in the \build\lib\armeabi-v7a folder under your Vuforia installation root.

Android.mk changes

If you have any reference to libQCAR.so in your Android.mk file, replace them with libVuforia.so.

Code changes

If you have the following code in your Java application code:

System.loadLibrary(  QCAR  );

Replace "QCAR" with "Vuforia," i.e.:

System.loadLibrary(  Vuforia  );

With the removal of the TYPE enum from the Tracker, Trackable and TrackableResult classes, and the introduction of the new Type class, certain operations that previously relied on the TYPE enum must be performed using the Type class and related API.

Refactoring ImageTracker to ObjectTracker

Vuforia 4.0 introduced a new ObjectTracker class as the parent class from which all Tracker types are inherited.
You will need to change all ImageTracker declarations to ObjectTracker.

To initialize a Tracker:

QCAR::ObjectTracker* objectTracker = static_cast<QCAR::ObjectTracker*> 
    (trackerManager.initTracker( QCAR::ObjectTracker::getClassType() ));

Similarly, to obtain a Tracker from the TrackerManager:

QCAR::ObjectTracker* objectTracker = static_cast<QCAR::ObjectTracker*> 
    (trackerManager.getTracker( QCAR::ObjectTracker::getClassType() ));

To compare TrackableResults types:

const QCAR::TrackableResult* result = state.getTrackableResult(tIdx);
if (result->isOfType QCAR::ImageTargetResult::getClassType()))
{
    // Do something target-specific
}

Similarly, to compare Trackable types:

const QCAR::Trackable& trackable = result.getTrackable();
if (trackable.isOfType QCAR::ImageTarget::getClassType()))
{
    // Do something target-specific
}

Additional Notes

1. The WordList::STORAGE_TYPE and DataSet::STORAGE_TYPE enums have been deprecated; you should use the new STORAGE_TYPE enum instead ( C++ => QCAR::STORAGE_TYPE, Java => com.qualcomm.vuforia.STORAGE_TYPE, C# (Unity) => STORAGE_TYPE)

2. The ImageTracker::resetExtendedTracking() requires the application to call Stop before. If the ImageTracker is not stopped, the resetExtendedTracking() function will return false and have no effect.