new ApkSigner.Builder(ImmutableList.of(signerConfig)) .setInputApk(unsignedApk.toFile()) .setOutputApk(signedApk.toFile()) .build(); apkSigner.sign();
/** * Sets the readable data sink which will receive the output (signed) APK. After signing, * the contents of the output APK will be available via the {@link DataSource} interface of * the sink. * * <p>This variant of {@code setOutputApk} is useful for avoiding writing the output APK to * a file. For example, an in-memory data sink, such as * {@link DataSinks#newInMemoryDataSink()}, could be used instead of a file. * * @see #setOutputApk(File) * @see #setOutputApk(DataSink, DataSource) */ public Builder setOutputApk(ReadableDataSink outputApk) { if (outputApk == null) { throw new NullPointerException("outputApk == null"); } return setOutputApk(outputApk, outputApk); }