In order to ease the creation of new Android JNI native/Java samples that can be built from Eclipse, the SDK includes a bash shell script that generates new projects from a selection of templates. This tool is called app_create
. It can create new applications in subdirectories of user_apps/
that can be used as the basis for more complex application projects. To use the script, do the following:
my_app
. A directory of the given name under user_apps/
must NOT already exist prior to running the script, or the script will fail. This is a safety measure to avoid overwriting existing code.com.mycorp.myapp
. MyApp
.basic
: similar to the framework used for most of the current samples, a simple template using nv_native_app_glue
.subclass
: a copy of the native_subclass
Android feature demo, with both native and Java code.
tools\app_create
directory../app_create.sh <app path name> <app java name> <template name>
./app_create.sh my_app MyApp nv_event
This will result in the new application being created in the indicated subdirectory of user_apps/
. To load the new application into Eclipse for building, simply re-run the steps previously mentioned for Setting up the Eclipse workspace, selecting only the new project from the project import dialog. The new application project should be added to your workspace.
The project may be treated exactly like any other project in the SDK. New source files may be added to the app’s jni
directory and Makefile
, an assets
directory, may be created and filled with assets for the APK, and additional settings may be added to the AndroidManifest.xml
.
The basic template is based directly on the sample app native_basic
, which is a pure native NativeActivity/nv_native_app_glue
application. The subclass template is based directly on the android feature demo native_subclass
, which includes app-written Java code.
If you need to move an app_create
-based application after creating it, note that the applications created with this script make relative-path reference to the samples pack’s libs/jni
directory. So if you move the application, you must change the app’s jni/Android.mk
line:
$(call import-add-path, ../../../libs/jni)
To reference the correct absolute or relative path to the samples pack’s libs source tree, or else the application will not build.
NVIDIA® GameWorks™ Documentation Rev. 1.0.220830 ©2014-2022. NVIDIA Corporation and affiliates. All Rights Reserved.