Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about New Module by Baseline Profile Generator on Android Studio Iguana #25

Open
Kane-Shih opened this issue Mar 28, 2024 · 0 comments
Assignees

Comments

@Kane-Shih
Copy link

Kane-Shih commented Mar 28, 2024

Env:

  • Android Studio
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

Non-Bundled Plugins:
    com.github.copilot (1.5.1.5285)
  • Project
AGP 8.2.0
Gradle 8.2
Kotlin 1.9.20
BaselineProfile 1.2.3
profileInstaller 1.3.1

modules: `app`, total: 1

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/usNonMinifiedInternal/google-play-services.json
  • /app/src/usNonMinifiedRelease/google-play-services.json
  • /app/src/usBenchmarkInternal/google-play-services.json
  • /app/src/usBenchmarkRelease/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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants