public final class Packager extends Object
Class making the final app package. The inputs are: - packaged resources (output of aapt) - code file (ouput of dx) - Java resources coming from the project, its libraries, and its jar files - Native libraries from the project or its library.
Modifiers | Name | Description |
---|---|---|
interface |
Packager.JarStatus |
Status for the addition of a jar file resources into the APK. |
Type | Name and description |
---|---|
def |
Packager(String apkLocation, String resLocation, com.android.ide.common.signing.CertificateInfo certificateInfo, String createdBy, com.android.builder.model.PackagingOptions packagingOptions, com.android.utils.ILogger logger) Creates a new instance. |
void |
addDexFiles(File mainDexFolder, Collection<File> extraDexFiles) |
void |
addFile(File file, String archivePath) Adds a file to the APK at a given path |
void |
addNativeLibraries(File nativeFolder, Set<String> abiFilters) Adds the native libraries from the top native folder. |
Packager.JarStatus |
addResourcesFromJar(File jarFile) Adds the resources from a jar file. |
static String |
getLocalVersion() |
void |
sealApk() Seals the APK, and signs it if necessary. |
void |
setJniDebugMode(boolean jniDebugMode) Sets the JNI debug mode. |
Creates a new instance. This creates a new builder that will create the specified output file, using the two mandatory given input files. An optional debug keystore can be provided. If set, it is expected that the store password is 'android' and the key alias and password are 'androiddebugkey' and 'android'. An optional com.android.utils.ILogger can also be provided for verbose output. If null, there will be no output.
apkLocation
- the file to createresLocation
- the file representing the packaged resource file.certificateInfo
- the signing information used to sign the package. Optional the OS path to the debug keystore, if needed or null.logger
- the logger.Adds a file to the APK at a given path
file
- the file to addarchivePath
- the path of the file inside the APK archive.Adds the native libraries from the top native folder. The content of this folder must be the various ABI folders. This may or may not copy gdbserver into the apk based on whether the debug mode is set.
nativeFolder
- the root folder containing the abi folders which contain the .soabiFilters
- a list of abi filters to include. If null or empty, all abis are included.Adds the resources from a jar file.
jarFile
- the jar File.Seals the APK, and signs it if necessary.
Sets the JNI debug mode. In debug mode, when native libraries are present, the packaging will also include one or more copies of gdbserver in the final APK file. These are used for debugging native code, to ensure that gdbserver is accessible to the application. There will be one version of gdbserver for each ABI supported by the application. the gbdserver files are placed in the libs/abi/ folders automatically by the NDK.
jniDebugMode
- the jni-debug mode flag.