Android Studio Iguana | 2023.2.1 Patch 1
Build #AI-232.10300.40.2321.11567975, built on March 13, 2024
Runtime version: 17.0.9+0-17.0.9b1087.7-11185874 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.2.1
GC: G1 Young Generation, G1 Old Generation
Memory: 16384M
Cores: 10
Metal Rendering is ON
Registry:
ide.instant.shutdown=false
ide.experimental.ui=true
## Question 1
(1) My app has 3 build types and 3 product flavors, thus there're 9 build variants.
build types: debug, internal, release
product flavors(region): us, eu, tw; Each of them has an unique application ID.
(2) My app uses plugin `com.google.gms.google-services` so there're 9 `google-play-services.json` files for each variant.
(3) After created a new baselineprofile module by Baseline Profile Generator on Android Studio Iguana (to `:app:baselineprofile`), it added `NonMinified` and `Benchmark` for non-debug builds, so I got 12(=(3-1)x3x2) more build variants.
Because of (2)+(3), I'll need to create 12 more folders for new variants to place each `google-play-services.json` file.
Example
- /app/src/us`NonMinified`Internal/google-play-services.json
- /app/src/us`NonMinified`Release/google-play-services.json
- /app/src/us`Benchmark`Internal/google-play-services.json
- /app/src/us`Benchmark`Release/google-play-services.json
Otherwise the error is
> * What went wrong:
Execution failed for task ':app:processUsNonMinifiedInternalGoogleServices'.
> File google-services.json is missing.
The Google Services Plugin cannot function without it.
Searched locations: ...
Is it expected? Any suggestions?
## Question 2
The generator in Android Studio created `baselineprofile` under `app` with a build.gradle.kts which defined productFlavors(us/eu/tw), but didn't define buildTypes(debug/internal/release). So the error message is like this:
> Could not determine the dependencies of task ':app:mergeUsInternalBaselineProfile'.
> Could not resolve all task dependencies for configuration ':app:usInternalBaselineProfile'.
> Could not resolve project :app:baselineprofile.
Required by:
project :app
> No matching variant of project :app:baselineprofile was found. The consumer was configured to find a component for use during 'baselineProfile', preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'internal', attribute 'com.android.build.api.attributes.ProductFlavor:region' with value 'us', attribute 'androidx.baselineprofile.gradle.configuration.attribute.BaselineProfilePluginAgpVersionAttr' with value '8.2.0', attribute 'androidx.baselineprofile.gradle.configuration.attribute.BaselineProfilePluginVersionAttr' with value 'alpha1' but:
...
## Question 3
`mergeIntoMain` must be in `app/build.gradle.kts` instead of `app/baselineprofile/build.gradle.kts`, is it expected?
It seems reasonable, just doesn't mention in https://developer.android.com/topic/performance/baselineprofiles/configure-baselineprofiles#generate-for-variants
There are many build.gradle.kts files in a repo, and sometimes the doc doesn't specify.
## Question 4
In StartupBenchmarks.kt and BaselineProfileGenerator.kt, the package name is hardcoded. What's the recommendation for multiple apps? By separating src folders?
Thanks :D
Env:
Non-Bundled Plugins: com.github.copilot (1.5.1.5285)
AGP 8.2.0 Gradle 8.2 Kotlin 1.9.20 BaselineProfile 1.2.3 profileInstaller 1.3.1
modules:
app
, total: 1build types: debug, internal, release product flavors(region): us, eu, tw; Each of them has an unique application ID.