Skip to content

Instantly share code, notes, and snippets.

@Nunocky
Last active July 7, 2023 02:43
Show Gist options
  • Save Nunocky/31937b82fa077a3db542063e6d4fc410 to your computer and use it in GitHub Desktop.
Save Nunocky/31937b82fa077a3db542063e6d4fc410 to your computer and use it in GitHub Desktop.
ほぼ定番の Androidのプラグイン
// プロジェクトの build.gradle
plugins {
...
id 'com.google.dagger.hilt.android' version '2.44' apply false
}
// アプリモジュール
// モジュールの build.gradle
id 'kotlin-kapt'
id 'com.google.dagger.hilt.android'
android {
buildFeatures() {
dataBinding true
}
}
dependencies {
implementation "com.google.dagger:hilt-android:2.44"
kapt "com.google.dagger:hilt-compiler:2.44"
implementation "androidx.activity:activity-ktx:+"
implementation "androidx.fragment:fragment-ktx:+"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1'
def lifecycle_version = "2.6.1"
def arch_version = "2.2.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// ViewModel utilities for Compose
// implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
// Lifecycles only (without ViewModel or LiveData)
// implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
// Annotation processor
//kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
// optional - helpers for implementing LifecycleOwner in a Service
//implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"
// optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
//implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"
// optional - ReactiveStreams support for LiveData
//implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version"
// optional - Test helpers for LiveData
androidTestImplementation "androidx.arch.core:core-testing:$arch_version"
// optional - Test helpers for Lifecycle runtime
androidTestImplementation "androidx.lifecycle:lifecycle-runtime-testing:$lifecycle_version"
// Navigation
def nav_version = "2.5.3"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
// Room
def room_version = "2.4.2"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
testImplementation "androidx.room:room-testing:$room_version"
// CameraX
def camerax_version = "1.1.0-beta01"
implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
implementation "androidx.camera:camera-video:${camerax_version}"
implementation "androidx.camera:camera-view:${camerax_version}"
implementation "androidx.camera:camera-extensions:${camerax_version}"
// Timber
implementation 'com.jakewharton.timber:timber:4.7.1'
}
// Allow references to generated code
kapt {
correctErrorTypes true
}
implementation "com.github.bumptech.glide:glide:${versions.glide}"
annotationProcessor "com.github.bumptech.glide:compiler:${versions.glide}"
testImplementation "com.google.truth:truth:${versions.truth}"
testImplementation "com.google.truth.extensions:truth-java8-extension:${versions.truth}"
testImplementation "androidx.test.ext:truth:${versions.ext_truth}"
androidTestImplementation "com.google.truth:truth:${versions.truth}"
androidTestImplementation "com.google.truth.extensions:truth-java8-extension:${versions.truth}"
androidTestImplementation "androidx.test.ext:truth:${versions.ext_truth}"
testImplementation "io.mockk:mockk-android:${versions.mockkVersion}"
testImplementation "io.mockk:mockk-agent:${versions.mockkVersion}"
androidTestImplementation "io.mockk:mockk-android:${versions.mockkVersion}"
androidTestImplementation "io.mockk:mockk-agent:${versions.mockkVersion}"
// https://square.github.io/retrofit/
implementation 'com.squareup.moshi:moshi-kotlin:1.13.0'
implementation "com.squareup.retrofit2:converter-moshi:2.9.0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment