android studio

   日期:2024-12-27    作者:hentongxj 移动:http://mip.riyuangf.com/mobile/quote/66390.html

Setting up openFrameworks with Android Studio is fairly straightforward. The basic steps are:

  • Install Android Studio and the Android SDK
  • Install the Android NDK (actually tested version is r15c)
  • Download openFrameworks from the download page or from git
  • If you got openFrameworks from git:
    • Run to download libraries.
    • Use the Project Generator to generate Android Studio project files for android examples.
  • In Android Studio, use Open an existing Android Studio project and select an openFrameworks example from the folder.
  • It will ask you for NDK location, either put the path in or click Project Structure and select the NDK location.
  • Let Android Studio download all other dependencies missing automatically.
  • Build and run

Download and install Android Studio from https://tools.android.com/download/studio/stable (you need Android Studio 1.0 or higher). It should come with (or automatically install) a recent SDK, though you can customize the SDK version later from within Android Studio using Tools ➞ Android ➞ SDK Manager.

In the event that Android Studio does not come with an SDK, you can install it from https://developer.android.com/sdk/index.html (under "Get the SDK for an existing IDE").

This is the C/C++ compiler, headers and libraries for Android. OF 0.10.0 has been tested with the NDK version r15c, newer versions might work but it's not guaranteed.

https://developer.android.com/ndk/downloads/older_releases

  • OS X: https://dl.google.com/android/repository/android-ndk-r15c-darwin-x86_64.zip
  • Linux 64: https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip
  • Windows 32: https://dl.google.com/android/repository/android-ndk-r15c-windows-x86.zip
  • Windows 64: https://dl.google.com/android/repository/android-ndk-r15c-windows-x86_64.zip

Once you downloaded the android ndk .zip, you'll have to install it in the "ndk" folder of android studio sdk. To know the path of the android studio sdk, open android studio. You should see the welcome screen. If you have an open project close it with "File" > "Close project". Click on the button at the bottom right : "Configure" > "SDK manager". Can also be found in "File" > "Settings" > "File At the top you should have a path pointing to the SDK location, called "Android SDK location". On windows it is probably :

Now in the file explorer go to that location, and look for a "ndk" folder. If it doesn't exist create one, and paste the extracted folder here...

Download it from the downloads page. Once downloaded, extract it in the location of your choice.

At the Android Studio welcome screen select Open an Existing Android Studio Project.

Then browse to any of the android examples in .

Accept all the prompts and wait for Android Studio to set up the project.

You'll have to wait a bit: the first sync will automatically build openFrameworks. If it doesn't work (Gradle sync still fails), try looking at the Troubleshooting tips bellow. In some cases, clicking on the error in the console window will take you to a solution, such as installing various versions of the Android SDK. In some cases, you may have to do this several times to solve several missing dependencies.

Press the Play button next to the shown in the toolbar. With any luck, it should build the app, and momentarily deploy it to your Android device (or prompt you to deploy it on a suitable emulator). If the app runs, congratulations! You have setup openFrameworks.

To deploy on your android device you may have to download the appropriate SDK (deppending on your android version). Your device have to be in "Develloper mode", with Usb debug activated.

To create new projects just use the project generator for your platform that you can find in the root folder. For linux you'll need to run



before being able to run the project generator

  • If you have an error like this :

    • Click on the link provided by the error, it should open a file.
    • in that file there is probably something a line like (Windows)
    • dupplicate this line and change "sdk.dir" in "ndk.dir", and add " dkandroid-ndk-15" at the end. You should have something like that :
    • Save the file, close the project and try to open the project again (You may have to do this for every example, but once you done it with the "empty android example" it should be fine)
  • If the error is asking to, install . In android studio, no project opened, go to "Configure" > "SDK manager" > "SDK Tools". Check the at the bottom. Install version 25.0.3 of .

  • You may need to adjust the following numbers to match your installed Android Studio and Android SDK. Android Studio should offer to fix these values for you when you open the appropriate build files.

    • The Gradle version specified in
    • The , , , values in and
  • If you get strange linker errors, check that you are using the 15c version of the NDK. Newer NDKs might work but usually there's some always some fixes that need to be done when moving to a new NDK version.

  • If you get make errors on gradle sync without any details, run from within the project folder to build the project from command line, and get more detailed error messages.


特别提示:本信息由相关用户自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。


举报收藏 0评论 0
0相关评论
相关最新动态
推荐最新动态
点击排行
{
网站首页  |  关于我们  |  联系方式  |  使用协议  |  隐私政策  |  版权隐私  |  网站地图  |  排名推广  |  广告服务  |  积分换礼  |  网站留言  |  RSS订阅  |  违规举报  |  鄂ICP备2020018471号