So you have heard of Augmented Reality (AR) and all the coolness you can do with it, you wanna try right?
There are a lot of AR engines out there but one of the best you can put the “dirty” hands on is Qualcomm Vuforia.
First of all you need to create an account on the developer page, after that you can login and go to the “Download” section.

20151117_img0
As you can see the SDK is available for Android, iOS and Unity, please notice also on the submenu items “Samples” and “Tools” we’re going to use them a bit later.
Proceed to download the SDK for Android (at the time of writing is avaible the version 5), unzip the content and take a look inside, the “build” folder is the interesting one,
infact it contains the library Vuforia.jar and the compiled engine libVuforia.so
You have seen the “Sample” directory right but it’s empty, so what?
As the readme.txt reports you need to download the examples from https://developer.vuforia.com/resources/sample-apps but the links is broken … the correct one is https://developer.vuforia.com/downloads/samples
From the above page you need to download, in the “Core Features” section, the Vuforia Sample Core for Android, check the page there are a lot of material here: Digital Eyewear examples (Google Carboard rules!), Advanced Topics, Best Practice and Vuforia Web Services.
Unzip Vuforia Samples, we’ll use the extracted folder as base for our test, open Android Studio and choose “Import project”, select the Vuforia Samples folder, set an Import Destination Directory, keeps all the import options, you have to set Vuforia.jar path edit the field with the location of Vuforia.jar contained in the SDK previously downloaded (Ex /Users/paolo/Downloads/vuforia-sdk-android-5-0-5/build/java/vuforia), click on Finish.
Android Studio should have imported the project, but there are a lot of errors related to unknow classes (Vuforia classes!), these because Vuforia.jar is not in the correct location.

20151117_img6
You need to create a “libs” folder in “app” folder of your project and move Vuforia.jar file from the /your_project_path/VuforiaSampleProject/app/src/main/java/Vuforia.jar to “libs” folder.
Now you need to modify your module build.gradle (not the project one!) file, add these lines at the end:

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

Sync the project with gradle, voilà errors are gone!

Build and run the project on your device, you should see something like this

20151117_img1

Try selecting Image Targets … arghhh nothing happens, we have to do 2 more things 😉
Project needs also libVuforia.so, an easy way to import this file in your project is create a zip from the “lib” folder from the Vuforia SDK folder:
20151117_img2
now move lib.zip in the “libs” folder of your project (the one that contains Vuforia.jar), rename lib.zip in lib.jar, recompile and run the project, select Image Targets:
20151117_img3
Ok told you, one last effort, the vuforia App key!

Open Vuforia developer portal page, go in Develop section, and click on Add License Key button, choose a name for the license (Ex. VuforiaSamples), select “Mobile” Device and “Starter – No Charge” License Key, confirm the data, you will receive an email related to Vuforia Application License Key.
Good! Select and copy the license created
20151117_img4
We need to paste the vuforia license in our example code, select SampleApplicationSession.java, find the inner class InitVuforiaTask, inside the method Vuforia.setInitParameters(Activity activity, int flags, String licenseKey) paste your code.

20151117_img7
Recompile & run your project, try for the last time and … fingers crossed, it works!
Ok, we need a marker (an image that is recognized from this sample, for the Image Targets we need Stones, Chips or Tarmac), all these images and others are in “media” folder inside the “Vuforia Samples“.
20151117_img5
Cool! 🙂

Final considerations
Try all the Vuforia samples, move on the advanced ones, you will find a lot to learn and to play with 🙂

Happy coding!

p.s. I’ve uploaded in my github page a Vuforia Samples project for Android studio for testing. Please remember to add the Vuforia license code 😉