Installing Vuforia in Android Studio

匿名 (未验证) 提交于 2019-12-03 02:27:02

问题:

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!

回答1:

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



回答2:

answer from here and work for me:

(Seems like the project needs access to the Vuforia.jar file and can't access it outside of the sample folder(?))

So,

  1. copy the Vuforia.jar file from the folder \vuforia-sdk-android-x-x-x\build\java\vuforia to a folder in the sample project, e.g. to \samples\app\libs (it's important it's in the "\app" path, so you can find it in the next step)

  2. in Android SDK hit F4 (or right click on the app folder in the project structure and click on "Open Module Settings". Select the tab "dependencies", click on the "+" to add a dependency and select "2 File dependency". Now select the above path and file ((\samples\app) \libs\Vuforia.jar) and the project will run just fine...

Good luck.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!