working on it ...


Explore Public Snippets

Sort by

Found 95 snippets matching: ndk

    public by FMXExpress modified Nov 12, 2014  7061  9  9  4

    Install A Shortcut On Android With Delphi XE5 Firemonkey
    //Android permission required:
    //<uses-permission android:name=””/>
    Androidapi.JNI.GraphicsContentViewText, FMX.Helpers.Android,
    Androidapi.JNI.JavaTypes, FMX.Platform.Android, AndroidApi.JniBridge, AndroidApi.Jni.App,
    ShortcutIntent: JIntent;
    addIntent: JIntent;
    wIconIdentifier : integer;
    wIconResource : JIntent_ShortcutIconResource;
    ShortcutIntent := TJIntent.JavaClass.init(SharedActivityContext, SharedActivityContext.getClass);
    addIntent := TJIntent.Create;
    addIntent.putExtra(TJIntent.JavaClass.EXTRA_SHORTCUT_INTENT, TJParcelable.Wrap((shortcutIntent as ILocalObject).GetObjectID));// here we need to cast the intent as it’s not done in delphi by default, not like java
    addIntent.putExtra(TJIntent.JavaClass.EXTRA_SHORTCUT_NAME, StringToJString(Application.Title));
    // get icon resource identifier
    wIconIdentifier := SharedActivity.getResources.getIdentifier(StringToJString(‘ic_launcher’), StringToJString(‘drawable’), StringToJString(‘com.embarcadero.HeaderFooterApplication’)); // if the app name change, you must change the package name
    wIconResource := TJIntent_ShortcutIconResource.JavaClass.fromContext(SharedActivityContext, wIconIdentifier);
    // set icon for shortcut
    addIntent.putExtra(TJIntent.JavaClass.EXTRA_SHORTCUT_ICON_RESOURCE, TJParcelable.Wrap((wIconResource as ILocalObject).GetObjectID));

    external by brettdh modified Nov 29, 2014  91  0  1  0

    Script to search paths for importable Android NDK modules and symlink their build files to $NDK_MODULE_PATH.

    Script to search paths for importable Android NDK modules and symlink their build files to $NDK_MODULE_PATH.:
    #!/usr/bin/env python
    import os, sys, re
    import argparse
    from itertools import combinations
    module_re = re.compile("LOCAL_MODULE[^a-z_]+([a-z_]+)")
    build_re = re.compile("BUILD_SHARED_LIBRARY")
    def getModules(android_makefile):
        cur_module = None
        modules = []
        with open(android_makefile) as f:
            for line in f.readlines():
                module_match =, line)
                if module_match:
                    cur_module =
                build_match =, line)
                if build_match:
        return modules
    def main():
        if "NDK_MODULE_PATH" not in os.environ:
            print "Please define NDK_MODULE_PATH first."
        parser = argparse.ArgumentParser(description="Searches a directory tree for NDK modules and " +
                                         "adds symlinks to NDK_MODULE_PATH for them.")
        parser.add_argument("search_dirs", nargs="+", 
                            help="one or more directories to search for NDK modules.")
        parser.add_argument("--namespace", default="edu.umich.mobility", help="Directory where symlinks will be placed.")
        args = parser.parse_args()
        for dir_pair in combinations(args.search_dirs, 2):
            if dir_pair[0] in dir_pair[1] or dir_pair[1] in dir_pair[0]:
                print "Error: search dirs mustn't overlap"
                parser.error("%s and %s have a common path element" % dir_pair)
        module_dirs = {}
        ndk_module_path = os.environ["NDK_MODULE_PATH"].strip()
        if ":" in ndk_module_path:
            ndk_module_path = ndk_module_path.split(":")[0]
        if not os.path.exists(ndk_module_path):
        namespace_path = "%s/%s" % (ndk_module_path, args.namespace)
        if not os.path.exists(namespace_path):
        for root_dir in args.search_dirs:
            if not os.path.exists(root_dir):
                print "Skipping %s; doesn't exist" % root_dir
            for dirpath, dirs, files in os.walk(root_dir):
                if "" in files:
                    mk_path = "%s/" % dirpath
                    print "Found %s" % mk_path
                    cur_modules = getModules(mk_path)
                    for module_name in cur_modules:
                        module_dirs[module_name] = dirpath
        print "About to symlink modules into %s" % namespace_path
        for entry in module_dirs.items():
            module_name, module_path = entry
            print "  %-10s => %s" % (module_name, module_path)
        confirm = raw_input("Proceed? [y/n] ")
        if not confirm.lower().startswith("y"):
            print "Making no symlinks."
        for entry in module_dirs.items():
            module_name, module_path = entry
            link_path = "%s/%s" % (namespace_path, module_name)
            if os.path.exists(link_path):
                print "%s already exists" % link_path
                print "Symlink: %s => %s" % (link_path, module_path)
                os.symlink(module_path, link_path)
    if __name__ == '__main__':

    external by mnemonicflow modified Jan 5, 2016  868  13  3  0

    Android NDK samples

    Android NDK samples
    # [Android NDK samples](
    1. [Hello JNI](
    Hello JNI is an Android sample that uses JNI to call C code from a Android Java Activity.
    2. [Hello Third Party](
    Hello Third Party Lib is an Android C++ sample that depends on a prebuilt static library (Play Game C++ SDK).
    3. [Hello GL2](
    Hello GL2 is an Android C++ sample that draws a triangle using GLES 2.0 API.
    It uses JNI to do the rendering in C++ over a
    4. [gles3jni](
    gles3jni is an Android C++ sample that demonstrates how to use OpenGL ES 3.0 from JNI/native code.
    The OpenGL ES 3.0 rendering path uses a few new features compared to the
    OpenGL ES 2.0 path:
    - Instanced rendering and vertex attribute divisor to reduce the number of
      draw calls and uniform changes.
    - Vertex array objects to reduce the number of calls required to set up
      vertex attribute state on each frame.
    - Explicit assignment of attribute locations, eliminating the need to query
    5. [Teapot](
    Teapot is an Android C++ sample that draws a Teapot mesh using GLES 2.0 API and [NativeActivity](
    6. [More Teapots](
    More Teapots is an Android C++ sample that draws multiple instances of the same Teapot mesh using GLES 3.0 Instanced Rendering and [NativeActivity](
    7. [San Angeles](
    San Angeles is an Android port of a demo that uses GLES C/API to render a procedural scene.
    See the original [README]( for more details about the original GLES port.
    8. [Bitmap Plasma](
    Bitmap Plasma is an Android sample that uses JNI to render a plasma effect in an Android [Bitmap]( from C code.
    9. [Native Plasma](
    Native Plasma is an Android sample that renders a plasma effect in a Bitmap from C code using [Native Activity](
    10. [Native Activity](
    Native Activity is an Android sample that initializes a GLES 2.0 context and reads accelerometer data from C code using [Native Activity](
    11. [Endless Tunnel](
    Endless Tunnel is a sample game that shows how to:
    - use the Android Studio C++ support
    - implement a game using Android native glue
    - implement joystick support, including robust DPAD navigation for non-touch screens
    It is NOT the goal of this sample to show the best way to write the game logic, load resources, etc. The game itself was intentionally kept rudimentary in order to keep the focus on the Android Studio C++ integration. For example, this game contains textures and geometry hard-coded in code, which works for small demo games like this one, but doesn't scale well to real games.
    12. [Native Media](
    Native Media is an Android sample that uses OpenMAX AL to play a video.
    13. [Native Codec](
    Native Codec is an Android C++ sample that uses the Native Media Codec API to play a video.
    14. [Native Audio](
    Native Audio is an Android sample that plays and records sounds with the C++ OpenSLES API using JNI.
    15. [Audio-Echo](
    The sample demos how to use OpenSL ES to create a player and recorder in Android Fast Audio Path, and connect them to loopback audio. On most android devices, there is a optimized audio path that is tuned up for low latency purpose. The sample creates player/recorder to work in this highly optimized audio path(sometimes called native audio path, [low latency path](, or fast audio path). The application is validated against the following configurations:
      *   Android L    AndroidOne
      *   Android M    Nexus 5, Nexus 9
    16. [Sensor-Graph](
    Sensor graph is a C++ Android sample that read current accelerometer values and draw them using OpenGL.
    It demonstrate usage of the following Native C++ API:
    - [Sensors](
    - [Assets](

    external by kenmasumitsu modified Jul 17, 2015  160  0  2  0

    NDK log utils

    NDK log utils: gistfile1.txt
    #define TAG "TAG"
    #define LOG_VERBOSE(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__)
    #define LOG_DEBUG(...)   __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
    #define LOG_INFO(...)    __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
    #define LOG_WARN(...)    __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
    #define LOG_ERROR(...)   __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
    #define LOG_FATAL(...)   __android_log_print(ANDROID_LOG_FATAL, TAG, __VA_ARGS__)

    external by Github modified Mar 4, 2015  148  0  2  0

    NDK location

    NDK location:
    # The Android NDK home directory:
    # The list of native AAC decoders.
    # Allowed decoders are: faad2, ffmpeg, opencore-aacdec.
    # NOTE: if you change this property then it is recommended to clean the project
    #       (ant mrproper)
    # Examples:
    #   aac.decoders=opencore-aacdec
    #   aac.decoders=faad2 ffmpeg opencore-aacdec
    aac.decoders=faad2 ffmpeg opencore-aacdec
    # Enable 4-th decoder - MMS/ASF/WMA
    #   mms=yes
    # The debug level of the JNI/C code.
    # Allowed values are: trace, debug, info, warn, error
    # Options passed to the Makefile, e.g:
    #   -d               = debug all
    #   --debug=v        = set debug level (a, b, v, i, j, m)
    #   -qp              = print the database of rules (nothing remade)
    # Or targets:
    #   dump             = dumps all targets

    external by sxyx2008 modified Sep 9, 2014  80  1  1  0

    ndk r9d url

    ndk r9d url:
    # NDK r9d url
    * linux: [](
    * windows: [](
    * mac os x: [](

    external by Jan Holman modified Dec 15, 2015  80  0  1  0

    Duplicity v MZK a NDK fedorách

    Duplicity v MZK a NDK fedorách: Kořeny (s počtem objektů)
    1036 null
    7444 uuid:c3318d70-6f69-11e2-b9fa-005056827e52 Čin
    1037 uuid:ec78e650-298d-11e2-9f39-005056827e51 Brno v minulosti a dnes: sborník příspěvků k dějinám a výstavbě Brna
       1 uuid:4eac74b0-e92c-11dc-9fa1-000d606f5dc6 Rudé právo (jen 1? wtf?)
     101 uuid:4e0bb760-7ce2-11e2-b930-005056827e51 Nauka o pěstování révy vinné
      81 uuid:724767d0-9864-11e2-9a9f-005056827e51 Pěstování révy vinné v domácích zahrádkách
      29 uuid:7429cb92-9cb3-11e0-8637-0050569d679d Atlas d'Afrique En 20. Carter
    5805 uuid:8376d290-87e1-11e2-b238-005056827e52 Slovo národa
     630 uuid:98e18620-c828-11e2-b6da-005056827e52 Kniha pro každého rolníka a hospodáře: sbírka vědomostí hospodářských rolníku našemu předůležitých a nevyhnutelně potřebných
     257 uuid:992aeaa0-1cd3-11e2-bec6-005056827e51 Chotěšov a jeho dominanta (btw to nemá obrázky)

    external by Intern modified Feb 25, 2015  68  0  1  0

    Install Android SDK & NDK on Ubuntu

    Install Android SDK & NDK on Ubuntu:
    # Check machine type (32 or 64-bit) & install JDK
    MACHINE_TYPE=`uname -a`
    sudo apt-get install openjdk-7-jdk
    # Prepare /opt/Google directory 
    sudo chmod ao+rw /opt
    sudo chown :adm /opt
    mkdir /opt/Google/
    # Download Android NDK
    if [[ $MACHINE_TYPE == *"x86_64"* ]]
    # Install Android NDK
    chmod +x android-ndk*.bin
    rm -rf eclipse-java*
    mkdir /opt/Google/android-ndks
    rm android-ndk-*.bin
    mv android-ndk-* /opt/Google/android-ndks/
    # Download Eclipse
    if [[ $MACHINE_TYPE == *"x86_64"* ]]
    # Install Eclipse
    rm -rf /opt/eclipse
    tar -zxvf eclipse-java-luna-SR1a-linux-gtk*.tar.gz -C /opt/
    rm -rf eclipse-java*
    # Install Android SDK and configure SDK & NDK
    echo Add ADT Plugin software site at
    echo Select Android Development Tools
    echo Select Android Native Development Tools
    echo When prompted by Android Development (Welcome to Android Development window)
    echo - include Android 2.2 in installation
    echo - at the same time point target directory to /opt/Google/android-sdks/
    echo Add Android API 8 & 10
    echo Point Window -> Preferences -> Android -> NDK -> NDK Location to the right path
    echo Press ENTER to launch Eclipse
    /opt/eclipse/eclipse &
    echo Press ENTER when finished

    external by Andrew Paramoshkin modified Nov 22, 2016  68  0  1  0

    Dockerfile for using in GitLab CI (or similar) to create Android builds. Includes Android SDK 24 and r13b Android NDK

    Dockerfile for using in GitLab CI (or similar) to create Android builds. Includes Android SDK 24 and r13b Android NDK: Dockerfile
    FROM openjdk:8-jdk
    MAINTAINER Andrew Paramoshkin <>
        ANDROID_BUILD_TOOLS="24.0.0" \
        ANDROID_SDK_TOOLS="24.4.1" \
        ANDROID_NDK_VERSION="13" \
    RUN apt-get --quiet update --yes
    RUN apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
    RUN wget --quiet --output-document=android-sdk.tgz${ANDROID_SDK_TOOLS}-linux.tgz && \
        tar --extract --gzip --file=android-sdk.tgz
    RUN mkdir "/android-sdk-linux/licenses" || true && \
    	echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "/android-sdk-linux/licenses/android-sdk-license" && \
    	echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "/android-sdk-linux/licenses/android-sdk-preview-license"
    RUN echo y | android --silent update sdk --no-ui --all --filter android-${ANDROID_TARGET_SDK} && \
        echo y | android --silent update sdk --no-ui --all --filter platform-tools && \
        echo y | android --silent update sdk --no-ui --all --filter build-tools-#{ANDROID_BUILD_TOOLS}
    RUN echo y | android --silent update sdk --no-ui --all --filter extra-android-m2repository && \
        echo y | android --silent update sdk --no-ui --all --filter extra-google-google_play_services && \
        echo y | android --silent update sdk --no-ui --all --filter extra-google-m2repository
    RUN wget --quiet${ANDROID_NDK_VERSION} && \
    RUN rm android-sdk.tgz && rm
    ENV "ANDROID_HOME" $PWD/android-sdk-linux

    external by Anthony Guevara modified Nov 14, 2016  68  0  1  0

    ndk cross compiler env variables

    ndk cross compiler env variables: ndk_cc_env_variables.txt
    Environment variables to set:
      export NDK="/home/anthony/android-ndk-r13b"
      export TOOLCHAIN="/home/anthony/android-toolchain"
      export export SYSROOT="/home/anthony/android-ndk-r13b/platforms/android-21/arch-arm"
      export CC="/home/anthony/android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc-4.9 --sysroot=$SYSROOT"
    Programs needed on top of the NDK and SDK:  
      sudo apt-get install android-tools-adb android-tools-fastboot
    Building the standalone toolchain:
      $NDK/build/tools/ --arch arm --api 21 --install-dir /home/anthony/android-toolchain
    • Public Snippets
    • Channels Snippets