天天看點

如何使用vuforiaSDK開發第一個AR demo應用

1.If you are using or planning to use the Android Studio IDE, here are some notes about how to import and build the Vuforia samples:

首先安裝好環境:JDK,NDK,AndroidSDK,AndroidStudio IDE

  • Read our Getting Started Guide for instructions on setting up the Java SDK, Android SDK and NDK:
  • ​​https://developer.vuforia.com/resources/dev-guide/getting-started-android-native-sdk​​
  • Make sure you have installed the latest version available of Android Studio from:
  • ​​http://developer.android.com/sdk/installing/studio.html​​
  • 下載下傳好VuforiaSDK for Android :(暫時沒什麼用)             https://developer.vuforia.com/downloads/sdk
  • Use the AndroidSDK Manager(from within Android Studio) to get the latest Android SDK and Platform tools
  • Launch Android Studio
  • 下載下傳示例程式      https://developer.vuforia.com/downloads/samples
  • SelectFile - > Import Project ... 導入示例程式
  • Select "Create Project from Existing Source" (選擇已經存在的AS project) and select the  sample directory (or any other Vuforia sample) to import the sample project
  • 在項目設定那裡設定NDK路徑
  • Click Apply
  • Compile the project
  • Build the native codeusingndk-build (as explained in our Getting Started guide)
  • Run the app on your device

2.申請key

如果不申請項目key,會報錯

​​https://developer.vuforia.com/targetmanager/licenseManager/licenseListing​​

申請完成後,點選APP NAME可以看到申請的key

3.為項目配置key

添加key的方法是在 SampleApplicationSession類裡面的

Vuforia.setInitParameters(mActivity, mVuforiaFlags, " ");  空格裡面就是填寫key