throw new SigningException("Failed to read key from keystore");
}
}
try {
Packager packager = new Packager(
outApkLocation, androidResPkgLocation, dexFolder,
certificateInfo, mCreatedBy, packagingOptions, mLogger);
packager.setJniDebugMode(jniDebugBuild);
// figure out conflicts!
JavaResourceProcessor resProcessor = new JavaResourceProcessor(packager);
if (javaResourcesLocation != null) {
resProcessor.addSourceFolder(javaResourcesLocation);
}
// add the resources from the jar files.
Set<String> hashs = Sets.newHashSet();
for (File jar : packagedJars) {
// TODO remove once we can properly add a library as a dependency of its test.
String hash = getFileHash(jar);
if (hash == null) {
throw new PackagerException("Unable to compute hash of " + jar.getAbsolutePath());
}
if (hashs.contains(hash)) {
continue;
}
hashs.add(hash);
packager.addResourcesFromJar(jar);
}
// also add resources from library projects and jars
if (jniLibsFolders != null) {
for (File jniFolder : jniLibsFolders) {
if (jniFolder.isDirectory()) {
packager.addNativeLibraries(jniFolder, abiFilters);
}
}
}
packager.sealApk();
} catch (SealedPackageException e) {
// shouldn't happen since we control the package from start to end.
throw new RuntimeException(e);
}
}