private void doAddFile(File file, String archivePath) throws DuplicateFileException, IOException { verbosePrintln("%1$s => %2$s", file, archivePath); File duplicate = checkFileForDuplicate(archivePath); if (duplicate != null) { throw new DuplicateFileException(archivePath, duplicate, file); } mAddedFiles.put(archivePath, file); mBuilder.writeFile(file, archivePath); }
verbosePrintln("Native folder: %s", nativeFolder);
/** * Adds the content from a zip file. * All file keep the same path inside the archive. * @param zipFile the zip File. * @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. */ public void addZipFile(File zipFile) throws ApkCreationException, SealedApkException, DuplicateFileException { if (mIsSealed) { throw new SealedApkException("APK is already sealed"); } try { verbosePrintln("%s:", zipFile); // reset the filter with this input. mNullFilter.reset(zipFile); // ask the builder to add the content of the file. FileInputStream fis = new FileInputStream(zipFile); mBuilder.writeZip(fis, mNullFilter); fis.close(); } catch (DuplicateFileException e) { mBuilder.cleanUp(); throw e; } catch (Exception e) { mBuilder.cleanUp(); throw new ApkCreationException(e, "Failed to add %s", zipFile); } }
certificate); verbosePrintln("Packaging %s", mApkFile.getName());
verbosePrintln("%s:", jarFile);