GitXplorerGitXplorer
a

ndk-samples

public
10156 stars
4200 forks
22 issues

Commits

List of commits on branch main.
Unverified
69fe5a569be4388d69cfbf0ff59372bdaf3a984a

Appropriate naming for JniHandler and associated usages

nnur-shuvo committed 10 days ago
Unverified
03e7823f9e806d6feee47e210381b8f0643e1323

Run upgrade assistant.

DDanAlbert committed 3 months ago
Unverified
a4f70e70eb9af27c1eb783b2325e122e14300fbd

Use testOnly in unit-test sample.

DDanAlbert committed 3 months ago
Unverified
9d38db97bd23f5a3c7ea2a3e711402e4a9f78551

Move build status badge in README

ttjohns committed 4 months ago
Unverified
bc535eeaf53c134bd6aa9006ac66d1afd79dd3c3

Add plumbing for changing the CMake version.

DDanAlbert committed 4 months ago
Unverified
121154b5a4471b3f23620a688ddc0af1fdbbfc7d

Upgrade to NDK r27b.

DDanAlbert committed 4 months ago

README

The README file for this repository.

Android NDK Samples

This repository contains sample apps that use the Android NDK.

For an explanation of the layout of this repository, see ARCHITECTURE.md.

Build and run

build

  1. Clone the repository
  2. Open the whole project in Android Studio
  3. Select the sample you want to run in the top bar (you may need to sync gradle first)
  4. Click the play button to run the sample

You can also build the samples from the command line if you prefer. Use ./gradlew build to build everything (if you're on Windows, use .\gradlew.bat instead of ./gradlew). For individual tasks, see ./gradlew tasks. To see the tasks for an individual sample, run the tasks task for that directory. For example, ./gradlew :camera:basic:tasks will show the tasks for the camera/basic app.

I just want something to copy from as a starting point

The samples in this repository are generally not a good starting point for a production quality app. They aim to demonstrate individual NDK APIs, but often make sacrifices to be succinct that make them unsuitable for a production app. This is gradually changing, but for now you should not do this.

Now in Android is an excellent resource for production quality apps in general, but does not touch on NDK- specific issues. https://github.com/DanAlbert/ndk-app-template can help some with that until this repository is able to.

You're most likely best served by using the New Project wizard in Android Studio to create a new app, then using those resources and the samples here as a reference. Android Studio's "Native C++" template is a good starting point for typical applications that need to use some C++ via JNI. The "Game Activity" template is a good starting point for game-like apps (that is, apps that do not use the Android UI, but instead render their own UI using OpenGL or Vulkan).

Additional documentation

Support

If you've found an issue with a sample and you know how to fix it, please send us a PR!.

If you need to report a bug, where it needs to be filed depends on the type of issue:

For questions about using the NDK or the platform APIs, you can ask on:

Additional NDK samples:

License

Copyright 2018 The Android Open Source Project, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

LICENSE