LifecycleOwner
インターフェイスに準拠したオブジェクトのライフサイクルに応じて、オブザーバーに情報を通知するオブジェクト。
$ adb devices
List of devices attached
L2NY760L6999J3D device
emulator-5554 device
$ adb shell ps -A -s K2AXB7606962J3D | grep app_name
u0_u999 26810 924 4354472 79892 0 0 S com.example.android.codelabs.lifecycle
予め、Android端末のIPアドレスを控えておき、Android端末と開発端末を同じネットワークに接続しておく。
Android端末と開発端末を有線で接続する。
$ adb tcpip 5555
$ adb connect <<android ip adress>>
$ adb disconnect
[Android] debug ビルド時のソースを分ける & debug ビルドあれこれ - Qiita
if (BuildConfig.DEBUG) {
// ...
}
build.gradle(app)
と、AndroidManifest
の編集が必要。
buildTypes {
debug {
//デバッグ時のインストールでは、アプリケーションIDを分ける
//Google Play Store版、リリースビルドと共存するため
applicationIdSuffix = ".debug"
}
<provider
android:name="androidx.core.content.FileProvider"
<!-- 変更前 android:authorities="hogehoge-application-id-literal.fileprovider" -->
android:authorities="${applicationId}.fileprovider"
<!--後略-->
Androidのデバッグ版とリリース版でパッケージ名、バージョン名、アプリ名、アイコンを変更する - Qiita
build.gradleに定義する。
android {
...
productFlavors {
create("production")
create("develop")
}
}
if (BuildConfig.FLAVOR == "develop") {
//Product Flavorが"develop"のときに行う処理
}