code: private void init(File apkFile, File resFile, File dexFile, PrivateKey key,
              X509Certificate certificate, PrintStream verboseStream) throws ApkCreationException {
  
          try {
              checkOutputFile(mApkFile = apkFile);
              checkInputFile(mResFile = resFile);
              if (dexFile != null) {
                  checkInputFile(mDexFile = dexFile);
              } else {
                  mDexFile = null;
              }
              mVerboseStream = verboseStream;
  
              mBuilder = new SignedJarBuilder(
                      new FileOutputStream(mApkFile, false /* append */), key,
                      certificate);
  
              verbosePrintln("Packaging %s", mApkFile.getName());
  
              // add the resources
              addZipFile(mResFile);
  
              // add the class dex file at the root of the apk
              if (mDexFile != null) {
                  addFile(mDexFile, SdkConstants.FN_APK_CLASSES_DEX);
              }
  
          } catch (ApkCreationException e) {
              if (mBuilder != null) {
                  mBuilder.cleanUp();
              }
              throw e;
          } catch (Exception e) {
              if (mBuilder != null) {
                  mBuilder.cleanUp();
              }
              throw new ApkCreationException(e);
          }
      }
docs: Constructor init method.
  
  @see #ApkBuilder(File, File, File, String, PackagingOptions, PrintStream)
  @see #ApkBuilder(String, String, String, String, PackagingOptions, PrintStream)
  @see #ApkBuilder(File, File, File, PrivateKey, X509Certificate, PackagingOptions, PrintStream)