|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.android.sdklib.build.ApkBuilder
public final class ApkBuilder
Class making the final apk packaging. The inputs are: - packaged resources (output of aapt) - code file (output of dx) - Java resources coming from the project, its libraries, and its jar files - Native libraries from the project or its library.
Nested Class Summary | |
---|---|
static class |
ApkBuilder.FileEntry
|
static interface |
ApkBuilder.JarStatus
Status for the addition of a jar file resources into the APK. |
static class |
ApkBuilder.SigningInfo
Signing information. |
Constructor Summary | |
---|---|
ApkBuilder(java.io.File apkFile,
java.io.File resFile,
java.io.File dexFile,
java.security.PrivateKey key,
java.security.cert.X509Certificate certificate,
java.io.PrintStream verboseStream)
Creates a new instance. |
|
ApkBuilder(java.io.File apkFile,
java.io.File resFile,
java.io.File dexFile,
java.lang.String debugStoreOsPath,
java.io.PrintStream verboseStream)
Creates a new instance. |
|
ApkBuilder(java.lang.String apkOsPath,
java.lang.String resOsPath,
java.lang.String dexOsPath,
java.security.PrivateKey key,
java.security.cert.X509Certificate certificate,
java.io.PrintStream verboseStream)
Creates a new instance. |
|
ApkBuilder(java.lang.String apkOsPath,
java.lang.String resOsPath,
java.lang.String dexOsPath,
java.lang.String storeOsPath,
java.io.PrintStream verboseStream)
Creates a new instance. |
Method Summary | |
---|---|
void |
addFile(java.io.File file,
java.lang.String archivePath)
Adds a file to the APK at a given path |
void |
addNativeLibraries(java.io.File nativeFolder)
Adds the native libraries from the top native folder. |
void |
addNativeLibraries(java.util.List<ApkBuilder.FileEntry> entries)
|
ApkBuilder.JarStatus |
addResourcesFromJar(java.io.File jarFile)
Adds the resources from a jar file. |
void |
addSourceFolder(java.io.File sourceFolder)
Adds the resources from a source folder. |
static void |
addSourceFolder(IArchiveBuilder builder,
java.io.File sourceFolder)
Adds the resources from a source folder to a given IArchiveBuilder |
void |
addZipFile(java.io.File zipFile)
Adds the content from a zip file. |
static boolean |
checkFileForPackaging(java.lang.String fileName)
Checks a file to make sure it should be packaged as standard resources. |
static boolean |
checkFileForPackaging(java.lang.String fileName,
java.lang.String extension)
Checks a file to make sure it should be packaged as standard resources. |
static boolean |
checkFolderForPackaging(java.lang.String folderName)
Checks whether a folder and its content is valid for packaging into the .apk as standard Java resource. |
static ApkBuilder.SigningInfo |
getDebugKey(java.lang.String storeOsPath,
java.io.PrintStream verboseStream)
Returns the key and certificate from a given debug store. |
static java.lang.String |
getDebugKeystore()
|
static java.util.List<ApkBuilder.FileEntry> |
getNativeFiles(java.io.File nativeFolder,
boolean debugMode)
|
void |
sealApk()
Seals the APK, and signs it if necessary. |
void |
setDebugMode(boolean debugMode)
Sets the debug mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ApkBuilder(java.lang.String apkOsPath, java.lang.String resOsPath, java.lang.String dexOsPath, java.lang.String storeOsPath, java.io.PrintStream verboseStream) throws ApkCreationException
PrintStream
can also be provided for verbose output. If null, there will
be no output.
apkOsPath
- the OS path of the file to create.resOsPath
- the OS path of the packaged resource file.dexOsPath
- the OS path of the dex file. This can be null for apk with no code.verboseStream
- the stream to which verbose output should go. If null, verbose mode
is not enabled.
ApkCreationException
public ApkBuilder(java.lang.String apkOsPath, java.lang.String resOsPath, java.lang.String dexOsPath, java.security.PrivateKey key, java.security.cert.X509Certificate certificate, java.io.PrintStream verboseStream) throws ApkCreationException
PrivateKey
and X509Certificate
can be provided to sign the APK.
An optional PrintStream
can also be provided for verbose output. If null, there will
be no output.
apkOsPath
- the OS path of the file to create.resOsPath
- the OS path of the packaged resource file.dexOsPath
- the OS path of the dex file. This can be null for apk with no code.key
- the private key used to sign the package. Can be null.certificate
- the certificate used to sign the package. Can be null.verboseStream
- the stream to which verbose output should go. If null, verbose mode
is not enabled.
ApkCreationException
public ApkBuilder(java.io.File apkFile, java.io.File resFile, java.io.File dexFile, java.lang.String debugStoreOsPath, java.io.PrintStream verboseStream) throws ApkCreationException
PrintStream
can also be provided for verbose output. If null, there will
be no output.
apkFile
- the file to createresFile
- the file representing the packaged resource file.dexFile
- the file representing the dex file. This can be null for apk with no code.debugStoreOsPath
- the OS path to the debug keystore, if needed or null.verboseStream
- the stream to which verbose output should go. If null, verbose mode
is not enabled.
ApkCreationException
public ApkBuilder(java.io.File apkFile, java.io.File resFile, java.io.File dexFile, java.security.PrivateKey key, java.security.cert.X509Certificate certificate, java.io.PrintStream verboseStream) throws ApkCreationException
PrivateKey
and X509Certificate
can be provided to sign the APK.
An optional PrintStream
can also be provided for verbose output. If null, there will
be no output.
apkFile
- the file to createresFile
- the file representing the packaged resource file.dexFile
- the file representing the dex file. This can be null for apk with no code.key
- the private key used to sign the package. Can be null.certificate
- the certificate used to sign the package. Can be null.verboseStream
- the stream to which verbose output should go. If null, verbose mode
is not enabled.
ApkCreationException
Method Detail |
---|
public static ApkBuilder.SigningInfo getDebugKey(java.lang.String storeOsPath, java.io.PrintStream verboseStream) throws ApkCreationException
storeOsPath
- the OS path to the debug store.verboseStream
- an option PrintStream
to display verbose information
ApkBuilder.SigningInfo
object or null.
ApkCreationException
public void setDebugMode(boolean debugMode)
debugMode
- the debug mode flag.public void addFile(java.io.File file, java.lang.String archivePath) throws ApkCreationException, SealedApkException, DuplicateFileException
addFile
in interface IArchiveBuilder
file
- the file to addarchivePath
- the path of the file inside the APK archive.
ApkCreationException
- if an error occurred
SealedApkException
- if the APK is already sealed.
DuplicateFileException
- if a file conflicts with another already added to the APK
at the same location inside the APK archive.public void addZipFile(java.io.File zipFile) throws ApkCreationException, SealedApkException, DuplicateFileException
zipFile
- the zip File.
ApkCreationException
- if an error occurred
SealedApkException
- if the APK is already sealed.
DuplicateFileException
- if a file conflicts with another already added to the APK
at the same location inside the APK archive.public ApkBuilder.JarStatus addResourcesFromJar(java.io.File jarFile) throws ApkCreationException, SealedApkException, DuplicateFileException
jarFile
- the jar File.
ApkBuilder.JarStatus
object indicating if native libraries where found in
the jar file.
ApkCreationException
- if an error occurred
SealedApkException
- if the APK is already sealed.
DuplicateFileException
- if a file conflicts with another already added to the APK
at the same location inside the APK archive.public void addSourceFolder(java.io.File sourceFolder) throws ApkCreationException, SealedApkException, DuplicateFileException
sourceFolder
- the source folder.
ApkCreationException
- if an error occurred
SealedApkException
- if the APK is already sealed.
DuplicateFileException
- if a file conflicts with another already added to the APK
at the same location inside the APK archive.public static void addSourceFolder(IArchiveBuilder builder, java.io.File sourceFolder) throws ApkCreationException, DuplicateFileException
IArchiveBuilder
sourceFolder
- the source folder.
ApkCreationException
- if an error occurred
DuplicateFileException
- if a file conflicts with another already added to the APK
at the same location inside the APK archive.public void addNativeLibraries(java.io.File nativeFolder) throws ApkCreationException, SealedApkException, DuplicateFileException
nativeFolder
- the native folder.
ApkCreationException
- if an error occurred
SealedApkException
- if the APK is already sealed.
DuplicateFileException
- if a file conflicts with another already added to the APK
at the same location inside the APK archive.setDebugMode(boolean)
public void addNativeLibraries(java.util.List<ApkBuilder.FileEntry> entries) throws SealedApkException, DuplicateFileException, ApkCreationException
SealedApkException
DuplicateFileException
ApkCreationException
public static java.util.List<ApkBuilder.FileEntry> getNativeFiles(java.io.File nativeFolder, boolean debugMode) throws ApkCreationException
ApkCreationException
public void sealApk() throws ApkCreationException, SealedApkException
ApkCreationException
ApkCreationException
- if an error occurred
SealedApkException
- if the APK is already sealed.public static java.lang.String getDebugKeystore() throws ApkCreationException
ApkCreationException
public static boolean checkFolderForPackaging(java.lang.String folderName)
folderName
- the name of the folder.public static boolean checkFileForPackaging(java.lang.String fileName)
fileName
- the name of the file (including extension)
public static boolean checkFileForPackaging(java.lang.String fileName, java.lang.String extension)
fileName
- the name of the file (including extension)extension
- the extension of the file (excluding '.')
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |