• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java MinSdkVersionException类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.android.apksig.apk.MinSdkVersionException的典型用法代码示例。如果您正苦于以下问题:Java MinSdkVersionException类的具体用法?Java MinSdkVersionException怎么用?Java MinSdkVersionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

MinSdkVersionException类属于com.android.apksig.apk包,在下文中一共展示了MinSdkVersionException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getMinSdkVersionFromApk

点赞 2

import com.android.apksig.apk.MinSdkVersionException; //导入依赖的package包/类
/**
 * Returns the minimum Android version (API Level) supported by the provided APK. This is based
 * on the {@code android:minSdkVersion} attributes of the APK's {@code AndroidManifest.xml}.
 */
private static int getMinSdkVersionFromApk(
        List<CentralDirectoryRecord> cdRecords, DataSource lhfSection)
                throws IOException, MinSdkVersionException {
    ByteBuffer androidManifest;
    try {
        androidManifest = getAndroidManifestFromApk(cdRecords, lhfSection);
    } catch (ZipFormatException | ApkFormatException e) {
        throw new MinSdkVersionException(
                "Failed to determine APK's minimum supported Android platform version",
                e);
    }
    return ApkUtils.getMinSdkVersionFromBinaryAndroidManifest(androidManifest);
}
 

开发者ID:F8LEFT,
项目名称:FApkSigner,
代码行数:18,
代码来源:ApkSigner.java

示例2: getMinSdkVersionFromApk

点赞 2

import com.android.apksig.apk.MinSdkVersionException; //导入依赖的package包/类
/**
 * Returns the minimum Android version (API Level) supported by the provided APK. This is based
 * on the {@code android:minSdkVersion} attributes of the APK's {@code AndroidManifest.xml}.
 */
static int getMinSdkVersionFromApk(
        List<CentralDirectoryRecord> cdRecords, DataSource lhfSection)
                throws IOException, MinSdkVersionException {
    CentralDirectoryRecord androidManifestCdRecord = null;
    for (CentralDirectoryRecord cdRecord : cdRecords) {
        if (ANDROID_MANIFEST_ZIP_ENTRY_NAME.equals(cdRecord.getName())) {
            androidManifestCdRecord = cdRecord;
            break;
        }
    }
    if (androidManifestCdRecord == null) {
        throw new MinSdkVersionException(
                "Unable to determine APK's minimum supported Android platform version"
                        + ": APK is missing " + ANDROID_MANIFEST_ZIP_ENTRY_NAME);
    }
    byte[] androidManifest;
    try {
        androidManifest =
                LocalFileRecord.getUncompressedData(
                        lhfSection, androidManifestCdRecord, lhfSection.size());
    } catch (ZipFormatException e) {
        throw new MinSdkVersionException(
                "Unable to determine APK's minimum supported Android platform version"
                        + ": malformed ZIP entry: " + androidManifestCdRecord.getName(),
                e);
    }
    return ApkUtils.getMinSdkVersionFromBinaryAndroidManifest(ByteBuffer.wrap(androidManifest));
}
 

开发者ID:nukc,
项目名称:ApkMultiChannelPlugin,
代码行数:33,
代码来源:ApkSigner.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)