Racka N
10/29/2022, 10:55 AM:benchmark
module to run tests. Clicking on the test class opens a dialog to choose a module but none of my modules are being listed. If I change the build variant of my main :app
module to debug
I can see all my other module except the one for :benchmark
. See the comments for my gradle setup. I'm on Android Studio Electric Eel Beta 03Racka N
10/29/2022, 10:56 AMbuild.gradle.kts
for benchmark module
plugins {
id("com.android.test")
kotlin("android")
}
android {
namespace = "work.racka.reluct.android.benchmark"
compileSdk = libs.versions.config.android.compilesdk.get().toInt()
defaultConfig {
minSdk = libs.versions.config.android.minsdk.get().toInt()
targetSdk = libs.versions.config.android.targetsdk.get().toInt()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
// This benchmark buildType is used for benchmarking, and should function like your
// release build (for example, with minification on). It"s signed with a debug key
// for easy local/CI testing.
create("benchmark") {
isMinifyEnabled = true
isShrinkResources = true
isDebuggable = true
signingConfig = getByName("debug").signingConfig
matchingFallbacks += listOf("release")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"../app/benchmark-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
targetProjectPath = ":android:app"
experimentalProperties["android.experimental.self-instrumenting"] = true
}
dependencies {
implementation(libs.junit.test)
implementation(libs.junit.test.ktx)
implementation(libs.espresso.core)
implementation(libs.androidx.benchmark.macro)
implementation(libs.androidx.test.uiautomator)
}
androidComponents {
beforeVariants(selector().all()) {
it.enabled = it.buildType == "benchmark"
}
}
build.gradle.kts
for my main app module
import org.jetbrains.kotlin.konan.properties.Properties
val desugaringVersion = libs.versions.desugaring.get()
plugins {
kotlin("android")
id("com.android.application")
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
}
android {
namespace = "work.racka.reluct"
compileSdk = libs.versions.config.android.compilesdk.get().toInt()
defaultConfig {
applicationId = libs.versions.config.android.applicationId.get()
minSdk = libs.versions.config.android.minsdk.get().toInt()
targetSdk = libs.versions.config.android.targetsdk.get().toInt()
versionCode = libs.versions.config.android.versioncode.get().toInt()
versionName = libs.versions.config.android.versionName.get()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
val properties = Properties()
properties.load(
project.rootProject.file("local.properties")
.reader()
)
buildConfigField(
"String",
"revenuecat_key",
properties.getProperty("revenuecat_key")
)
}
buildTypes {
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"<http://proguard-rules.pro|proguard-rules.pro>"
)
}
create("benchmark") {
initWith(getByName("release"))
signingConfig = signingConfigs.getByName("debug")
matchingFallbacks += listOf("release")
isDebuggable = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"<http://benchmark-rules.pro|benchmark-rules.pro>"
)
}
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
}
packagingOptions {
resources {
excludes += mutableSetOf(
"/META-INF/{AL2.0,LGPL2.1}",
"META-INF/licenses/ASM"
)
// Fixes conflicts caused by ByteBuddy library used in
// coroutines-debug and mockito
pickFirsts += mutableSetOf(
"win32-x86-64/attach_hotspot_windows.dll",
"win32-x86/attach_hotspot_windows.dll"
)
}
}
}
dependencies {
// Desugaring
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:$desugaringVersion")
// Dependency Modules
implementation(project(":android:compose:navigation"))
implementation(project(":android:compose:theme"))
implementation(project(":android:widgets"))
implementation(project(":common:di-integration"))
implementation(project(":common:features:screen-time"))
implementation(project(":common:persistence:settings"))
// Core Functionality
implementation(libs.core.ktx)
implementation(libs.appCompat)
implementation(libs.google.material)
implementation(libs.viewmodel.core)
// Testing
testImplementation(libs.junit.core)
testImplementation(libs.junit.test)
testImplementation(libs.junit.test.ktx)
androidTestImplementation(libs.junit.test)
testImplementation(libs.android.test.arch.core)
androidTestImplementation(libs.android.test.arch.core)
androidTestImplementation(libs.android.test.core)
// Compose
implementation(libs.compose.ui)
implementation(libs.activity.compose)
implementation(libs.compose.foundation)
// Testing Compose
androidTestImplementation(libs.compose.junit)
debugImplementation(libs.compose.tooling)
// Koin DI
implementation(libs.koin.android)
// Accompanist
implementation(libs.accompanist.system.ui.controller)
// Splash Screen
implementation(libs.splash.screen.core)
// Timber - Logging
implementation(libs.timber.log)
// Revenue Cat - Billing
implementation(libs.revenueCat.android)
// Firebase
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.auth)
implementation(libs.firebase.analytics)
implementation(libs.firebase.crashlytics)
}
Tower Guidev2
11/17/2022, 12:04 PM