LoginSignup
0
0

More than 5 years have passed since last update.

GradleのProductFlavorsごとに読み込むライブラリを切り替える

Posted at

概要

Gradleでproductフレーバーとstagingフレーバーで読み込むライブラリを変更する

方法

build.gradle
def PACKAGE_NAME = "com.exsample"
android {
    productFlavors {
        product {
            applicationId "${PACKAGE_NAME}"
        }
        staging {
            applicationId "${PACKAGE_NAME}.staging"
        }
        develop {
            applicationId "${PACKAGE_NAME}.develop"
        }
    }
}
dependencies {
    productCompile(name: "lib-release", ext: 'aar')
    stagingCompile(name: "lib-staging-release", ext: 'aar')
    developCompile(name: "lib-develop-release", ext: 'aar')
}

dependeciesの項目で「フレーバー名+Compile」で読み込むライブラリを変更することができる。

0
0
1

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
0
0