Installing Vuforia in Android Studio

Freddy Martínez picture Freddy Martínez · Apr 18, 2016 · Viewed 9.1k times · Source

Can anyone give me some instructions of how I'm supposed to install Vuforia in Android Studio? I'm making a new app and I need to use augmented reality with Vuforia. Hope you can help me!

Thanks a lot!

Answer

Sanket Prabhu picture Sanket Prabhu · May 10, 2016

You need to follow following Steps:

  • Read our Getting Started Guide for instructions on setting up the Java SDK, Android SDK and NDK:

    https://developer.vuforia.com/downloads/sdk

  • Make sure you have installed the latest version available of Android Studio from:

    http://developer.android.com/sdk/index.html

  • Use the Android SDK Manager (from within Android Studio) to get the latest Android SDK and Android Platform and Build tools

  • Launch Android Studio

  • Select File - > Import Project ... and browse to the root directory of the sample Vuforia project you want to open

  • Proceed in the Import Wizard dialog (click Next, Next) until you reach a page with this message:

    1. "Alternatively, you can fill in the actual path map in the table below":
    2. click to edit
    3. enter the actual path to the Vuforia.jar library (which is located under your vuforia_install_dir/build/java/vuforia)
  • In the Project view, right-click on the Project and expand the view hierarchy so to locate the Vuforia.jar under app > src > main

  • right-click on Vuforia.jar to open the context menu

  • click on the "Add as library..." option in the context menu

  • Alternatively, if you cannot locate the Vuforia.jar in your project hierarchy:

  • right-click on the Project and select, "Open Module Settings"

    1. select "App"
    2. then select the "Dependencies" tab
    3. Click on the "+" button to Add a File Dependency and browse to the
      Vuforia.jar file
  • Create a folder called "jniLibs" under the "app/src/main" folder under your Android Studio project directory

  • Copy the "armeabi-v7a" folder (including the libVuforia.so file located inside it) from the "vuforia_install_dir/build/lib" to the "app/src/main/jniLibs" folder

the resulting directory structure under your project root should be:

/app
  /src
     /main
        /jniLibs
             /armeabi-v7a
                 /**libVuforia.so**
  • If your project includes a "jni" folder, move it to a location outside of your project (otherwise Android Studio may attempt to compile the sources in that folder and may fail)
  • Clean and rebuild the project
  • Run the app on your device

Best Luck :)