本文整理汇总了Java中com.android.SdkConstants.FD_APK_NATIVE_LIBS属性的典型用法代码示例。如果您正苦于以下问题:Java SdkConstants.FD_APK_NATIVE_LIBS属性的具体用法?Java SdkConstants.FD_APK_NATIVE_LIBS怎么用?Java SdkConstants.FD_APK_NATIVE_LIBS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.android.SdkConstants
的用法示例。
在下文中一共展示了SdkConstants.FD_APK_NATIVE_LIBS属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNativeLibraries
/**
* 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.
*
* @param nativeFolder the native folder.
*
* @throws ApkCreationException if an error occurred
* @throws SealedApkException if the APK is already sealed.
* @throws DuplicateFileException if a file conflicts with another already added to the APK
* at the same location inside the APK archive.
*
* @see #setDebugMode(boolean)
*/
public void addNativeLibraries(File nativeFolder)
throws ApkCreationException, SealedApkException, DuplicateFileException {
if (mIsSealed) {
throw new SealedApkException("APK is already sealed");
}
if (!nativeFolder.isDirectory()) {
// not a directory? check if it's a file or doesn't exist
if (nativeFolder.exists()) {
throw new ApkCreationException("%s is not a folder", nativeFolder);
} else {
throw new ApkCreationException("%s does not exist", nativeFolder);
}
}
File[] abiList = nativeFolder.listFiles();
verbosePrintln("Native folder: %s", nativeFolder);
if (abiList != null) {
for (File abi : abiList) {
if (abi.isDirectory()) { // ignore files
File[] libs = abi.listFiles();
if (libs != null) {
for (File lib : libs) {
// only consider files that are .so or, if in debug mode, that
// are gdbserver executables
if (lib.isFile() &&
(PATTERN_NATIVELIB_EXT.matcher(lib.getName()).matches() ||
PATTERN_BITCODELIB_EXT.matcher(lib.getName()).matches() ||
(mDebugMode &&
SdkConstants.FN_GDBSERVER.equals(
lib.getName())))) {
String path =
SdkConstants.FD_APK_NATIVE_LIBS + "/" +
abi.getName() + "/" + lib.getName();
try {
doAddFile(lib, path);
} catch (IOException e) {
mBuilder.cleanUp();
throw new ApkCreationException(e, "Failed to add %s", lib);
}
}
}
}
}
}
}
}
示例2: getNativeFiles
public static List<FileEntry> getNativeFiles(File nativeFolder, boolean debugMode)
throws ApkCreationException {
if (!nativeFolder.isDirectory()) {
// not a directory? check if it's a file or doesn't exist
if (nativeFolder.exists()) {
throw new ApkCreationException("%s is not a folder", nativeFolder);
} else {
throw new ApkCreationException("%s does not exist", nativeFolder);
}
}
List<FileEntry> files = new ArrayList<FileEntry>();
File[] abiList = nativeFolder.listFiles();
if (abiList != null) {
for (File abi : abiList) {
if (abi.isDirectory()) { // ignore files
File[] libs = abi.listFiles();
if (libs != null) {
for (File lib : libs) {
// only consider files that are .so or, if in debug mode, that
// are gdbserver executables
if (lib.isFile() &&
(PATTERN_NATIVELIB_EXT.matcher(lib.getName()).matches() ||
PATTERN_BITCODELIB_EXT.matcher(lib.getName()).matches() ||
(debugMode &&
SdkConstants.FN_GDBSERVER.equals(
lib.getName())))) {
String path =
SdkConstants.FD_APK_NATIVE_LIBS + "/" +
abi.getName() + "/" + lib.getName();
files.add(new FileEntry(lib, path));
}
}
}
}
}
}
return files;
}