zoukankan      html  css  js  c++  java
  • Install NDK in Eclipse/Android Studio

      1、 Download NDK

    https://developer.android.com/tools/sdk/ndk/index.html

      2、Install NDK

    $ tar xvf android-ndk-r8e-linux-x86_64.tar.bz2 -C ~/Software/Android/
    $ cd Android
    $ mv android-ndk-r8e/ ndk/

      3、add PATH

    $ vim ~/.bashrc
    //----------------- add the following text ----------------------
    export NDK_HOME=/home/linx/Software/Android/ndk
    export PATH=${NDK_HOME}:$PATH
    //------------------------------------------------------------------------
    $ source ~/.bashrc

      4、test the ndk

    $ pwd
    ~/Software/Android/ndk/samples/hello-gl2
    
    $ ndk-build
    Compile++ thumb  : gl2jni <= gl_code.cpp
    StaticLibrary  : libstdc++.a
    SharedLibrary  : libgl2jni.so
    Install        : libgl2jni.so => libs/armeabi/libgl2jni.so    

      the object file is "libs/armeabi/libgl2jni.so"

      the ndk install success.

      then add the ndk to IDE.

      Eclipse :

      1、download CDT

      1) offline

    http://www.eclipse.org/cdt/downloads.php

      2) online

    Help -> Install New Software

      add the URL

    http://download.eclipse.org/tools/cdt/releases/juno/

      then the CDT install automatic.

      2、run ndk-build in the project exist

    $ pwd
    ~/Software/Android/ndk/samples/hello-jni
    
    $ ndk-build

      3、Import the project first

    File -> New -> Project.. -> Android Project from Existing Code

      browse form the project root directory.

      4、config the NDK in IDE

      1) File -> Properties

      2) builders -> New -> Program -> OK

      3)in Edit Configuration

    Name : hellojni (the project you want to build)

      Table Main :

    Location :
    /bin/bash
    Working Directory :
    /bin
    Arguments :
    -c "cd ~/Software/Android/ndk/samples/hello-jni/ && ndk-build"

      Table Refresh :

    click on "Refresh resources upon completion."
    
    then choose the "Specific resources"
    
    finally choose the "libs" in "Specific resources" and Finish it 

      Table Build Options :

    click on everything in "Run in builder"
    
    then choose the "Specify Resources"
    
    finally choose the "jni"  in "Specify Resources"

      Finish.

      Android Studio :

      ok, there is a FAQ answered this question:

    Is it planned to support NDK development in Android Studio or IntelliJ IDEA?
    
    We have recently announced that we’re starting work on an IDE for C++, and we plan to eventually support NDK development as part of that effort. As for NDK development support in Android Studio, Google hasn’t announced anything so far.

      so just run ndk-build in terminal.

  • 相关阅读:
    刷题-力扣-剑指 Offer 22. 链表中倒数第k个节点
    刷题-力扣-617. 合并二叉树
    刷题-力扣-1109. 航班预订统计
    刷题-力扣-606. 根据二叉树创建字符串
    刷题-力扣-563. 二叉树的坡度
    扛把子组20191017-8 alpha week 2/2 Scrum立会报告+燃尽图 07
    20191017-7 alpha week 2/2 Scrum立会报告+燃尽图 06
    20191017-6alpha week 2/2 Scrum立会报告+燃尽图 05
    扛把子组20191017-5 alpha week 2/2 Scrum立会报告+燃尽图 04
    记第一次 团建
  • 原文地址:https://www.cnblogs.com/plinx/p/3143461.html
Copyright © 2011-2022 走看看