当前位置: 首页>>代码示例>>Java>>正文


Java SdkConstants.FD_APK_NATIVE_LIBS属性代码示例

本文整理汇总了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);
                            }
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:66,代码来源:ApkBuilder.java

示例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;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:45,代码来源:ApkBuilder.java


注:本文中的com.android.SdkConstants.FD_APK_NATIVE_LIBS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。