4
0

More than 5 years have passed since last update.

Dynamic Feature Moduleに対応したアプリを、単一apk化する

Last updated at Posted at 2019-02-26

Dynamic Feature Moduleに対応すると、

./gradle assembleDebug

とかの実行時、apkが複数作られるようになります。
AndroidStudioでビルドするときは ▶ ボタンで動くけれど、コマンドラインからのインストールだと

adb install-multiple app.apk feature.apk

みたいにしないといけない。
何より、複数apkだとDeployGateとかでの社内配布で困る…(というか無理)
という場合、以下のようなコマンドでuniversalなapkを作成できます

./gradle packageDebugUniversalApk

apkファイルは、

/app/build/outputs/universal_apk/${variant.name}/app-${variant.baseName}-universal.apk

とかあたりに作られます。
${variant.name}${variant.baseName} は、gradleでの実行時のvariantのパラメータです。 flavordevbuildTypedebug だとすると、それぞれ devDebug , dev-debug という感じになります。

なお、本件対応時、CIにて

Program type already present: android.databinding.layouts.DataBindingInfo

のようなエラーがでたのですが、 com.android.tools.build を最新(本記事執筆時点では 3.3.1)まで上げると解消しました。
こちらの内容ですね。

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0