Android studio Where to install NDK file? (downloaded it in zip)

前端 未结 4 1066
予麋鹿
予麋鹿 2020-11-29 07:18

My android studio said it wanted to update. But when I did I tried to update it but it wouldn\'t work so I had to launch:
C:\\Users\\username\\AppData\\Local\\And

相关标签:
4条回答
  • 2020-11-29 07:46

    Yes, rename the extracted folder android-ndk-r13b(probably the exact name will be outdated someday soon) to ndk-bundle (you can put the NDK [and SDK for that matter] anywhere, and leave the name alone if you want {do not do this, I'm sure seen one case of hard-coded sub-path}),
    then, make the settings point to the location where you put it.

    Android Studio, File menu | Project Structure Ctrl+Alt+Shift+s
    (short-cut: ctrl+Alt+Shift+s):

    It might also be helpful to you to set/check the following environmental variables:

    NDK_HOME=C:\Android\sdk\ndk-bundle
    NDK_MODULE_PATH=C:\Android\sdk\ndk-bundle
    

    EXTRA stuff:

    While were doing environmental variables (belt-and-braces for SDK):

    ANDROID_HOME=C:\Android\sdk
    

    For JDK:

    JAVA_HOME=C:\Program Files\Java\jdk1.8.0_112
    JAVA_PATH=C:\Program Files\Java\jre1.8.0_112\bin
    

    JDK is the Java Development Kit.
    JRE is the Java Run-time Environment.

    If your tight on memory (RAM) for Gradle (700 Megabytes is about as low as you can go, other tools like monitor.bat use this variable too, it's ubiquitous) (clearly you want to make it as big a possible, without swapping making it extremely slow to build {note the underscore VERY important ! [it's a reserved name space conflict operator, don't ask me to explain it's VERY complicated !]}):

    _JAVA_OPTIONS=-Xmx700m
    

    Some Links

    Setting up for Android NDK development
    Add C and C++ Code to Your Project
    Getting Started with the NDK
    Using C and C++ Code in an Android App with the NDK

    0 讨论(0)
  • 2020-11-29 07:49

    In order to help those who are using MAC OSx, The process on MAC is as follows:

    • download ndk-bundle in zip format
    • run terminal
    • use below command to find your temp directory in mac (e.g. /var/folders/sp/31g4p3kd5l10c68qdy475krr0000gn/T/)

      echo $TMPDIR

    • change directory to PackageOperation01

      cd PackageOperation01

    • copy ndk-bundle.zip into the directory

      cp /path/to/ndk-bundle.zip /$TMPDIR/PackageOperation01/

    • start Android Studio and in SDK-Manager try to install ndk-bundle again.

    0 讨论(0)
  • 2020-11-29 07:50

    Download the .zip file. Start the installation through SDK manager.
    Go to %userprofile%\AppData\Local\Android\sdk\ndk-bundle and copy .installer folder to desktop and cancel the downloading in SDK manager.
    Open .installer folder and open .installationdata file and check the folder in which the file is being downloaded like:
    %userprofile%\AppData\Local\Temp\PackageOperation01.
    Copy downloaded .zip file to the folder PackageOperation01 or whatever listed in .installationdata file.
    Now copy the .installer folder from desktop to %userprofile%\AppData\Local\Android\sdk\ndk-bundle
    and start the SDK manager
    and start the installation again for NDK.
    The SDK manager will start the installation skipping the download process.

    0 讨论(0)
  • 2020-11-29 07:50

    In Mac, With Android studio 3.3.2, SDK Manager keeps choosing new temporary folder to download the ndk-bundle. The following steps helped to install the downloaded ndk zip file.

    1. Go to SDK manager, start downloading NDK.
    2. Go to ~/Library/Android/sdk/ndk-bundle/.installer
    3. cat .installData

    path=/var/folders/vr/mz4hsqqs0wlgj9sfcpn3wfn5g2lwk3/T/PackageOperation07

    PackageOperation0X is the temp folder chosen to download the zip file

    1. Copy downloaded android-ndk-r21d-darwin-x86_64.zip to this temp folder (PackageOperation0X)

    2. Copy ~/Library/Android/sdk/ndk-bundle folder to some other location

    3. Cancel the NDK download in SDK Manager

    4. cd ~/Library/Android/sdk/

    5. You may find ndk-bundle folder missing as download has been cancelled in the SDK Manager.

    6. Move the previously copied ndk-bundle to ~/Library/Android/sdk/

    7. Go to SDK manager, start downloading NDK again. Existing file will be scanned and installation will be started skipping the download step.

    0 讨论(0)
提交回复
热议问题