Status Update
Comments
dh...@gmail.com <dh...@gmail.com> #2
Thanks for your detailed post.
However, benchmark build type is under configured: at least isProfileable is not set to true for existing build type, probably there's more.
We should set isProfileable = true
by default when overriding an existing benchmark build type.
This issue is not about some specific configuration flag, but the general approach of dealing with external configuration. As a developer adopting baseline profiles, it seems extremely risky to me using a custom configuration due to how it's applied under the hood and the fact it may break default configuration.
I agree that is not great but this is a little tricky to do. For custom baseline profile build types we override all the properties. For benchmark I left it open to configure but it's mostly about these 2 properties:
isMinifyEnabled
isShrinkResources
I don't have a way to see if the user is setting them before overriding, so for this reason, I'd prefer not to. I agree with you that some other properties could be set by default to make this easier, i.e.:
isJniDebuggable = false
isDebuggable = false
isProfileable = true
The reason why I mentioned the release signing config in the beginning is because I want to use debug signing config.
In the specific of your issue, i.e. using a debug certificate can you override the benchmark and baseline profile setting? You should be able to do something like:
android {
buildTypes {
release { ... }
debug { ... }
benchmarkRelease {
...
signingConfig signingConfigs.debug
}
nonMinifiedRelease {
...
signingConfig signingConfigs.debug
}
}
}
cc...@google.com <cc...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
Author: Marcello Albano <
Link:
Added override for debuggable and profileable for benchmark builds in bpgp
Expand for full commit details
Added override for debuggable and profileable for benchmark builds in bpgp
Test: ./gradlew :benchmark:benchmark-baseline-profile-gradle-plugin:test
Bug: 369213505
Relnote: "isProfileable is always overridden in benchmark builds,
and isDebuggable is also now always overridden in both benchmark and
nonMinified (baseline profile capture) builds."
Change-Id: I487fa71083921682173f04fcbb477be5baf165f8
Files:
- M
benchmark/baseline-profile-gradle-plugin/src/main/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPlugin.kt
- M
benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt
Hash: 1906bbe52ba7ccb9ca0e1c1d6de33e7c91b5c6f0
Date: Fri Oct 11 10:07:06 2024
ra...@gmail.com <ra...@gmail.com> #4
I've landed a change that will set the following properties also when the benchmark build type already exists:
isJniDebuggable = false
isDebuggable = false
isProfileable = true
As well as the following for agp 8.0:
isDebuggable = false
I'm going ahead and closing this - if you've further questions please answer here and will reopen. Thanks.
cc...@google.com <cc...@google.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.benchmark:benchmark-baseline-profile-gradle-plugin:1.4.0-alpha04
ap...@google.com <ap...@google.com> #6
Since release signing config is used by default instead of debug
is not mentioned in release notes - maybe this is a bug?
Cause the last time I found it mentioned in the release notes was in version 1.1
signingConfig.debug is used as the default signing config (
) b/153583269
So, if the switch to the release one indeed happened - maybe it's an issue?
Description
Component used: Macrobenchmark Version used: AGP - v7.3.0 Profile Installer - v1.3.1 Devices/Android versions reproduced on: Vivo V2029, Android 12
I am trying to setup macrobenchmarking on my app which has multiple modules and multiple flavors and following the android developer guide. However, I am getting below error related to DROP_SHADER_CACHE even though I have added profileInstaller dependency on the target app.
com.example.macrobenchmark.ExampleStartupBenchmark > startup[V2029 - 12] FAILED java.lang.IllegalStateException: The DROP_SHADER_CACHE broadcast was not received. This most likely means that thehttps://developer.android.com/jetpack/androidx/releases/profileinstaller .
at androidx.benchmark.macro.MacrobenchmarkScope.dropShaderCache(MacrobenchmarkScope.kt:286)
androidx.profileinstaller
library used by the target apk is old. Please use1.3.0-alpha02
or newer. For more information refer to the release notes atI am using Android Gradle Plugin v7.3.0 and Profile Installer v1.3.1
Below error comes while running benchmark tests.
I have observed that APP installed as part of the above process crashes on launch. This might be the reason of above error.
Stacktrace of App Crash
2024-02-15 16:19:27.752 9069-9099 TestRunner com.example.macrobenchmark E failed: startup(com.example.macrobenchmark.ExampleStartupBenchmark) 2024-02-15 16:19:27.752 9069-9099 TestRunner com.example.macrobenchmark E ----- begin exception ----- 2024-02-15 16:19:27.774 9069-9099 TestRunner com.example.macrobenchmark E java.lang.IllegalStateException: The DROP_SHADER_CACHE broadcast was not received. This most likely means that thehttps://developer.android.com/jetpack/androidx/releases/profileinstaller .
at androidx.benchmark.macro.MacrobenchmarkScope.dropShaderCache(MacrobenchmarkScope.kt:286)
at androidx.benchmark.macro.MacrobenchmarkKt$macrobenchmarkWithStartupMode$1.invoke(Macrobenchmark.kt:440)
at androidx.benchmark.macro.MacrobenchmarkKt$macrobenchmarkWithStartupMode$1.invoke(Macrobenchmark.kt:422)
at androidx.benchmark.macro.MacrobenchmarkKt$macrobenchmark$measurements$1.invoke(Macrobenchmark.kt:251)
at androidx.benchmark.macro.MacrobenchmarkKt$macrobenchmark$measurements$1.invoke(Macrobenchmark.kt:241)
at androidx.benchmark.perfetto.PerfettoTraceProcessor$Companion.runServer(PerfettoTraceProcessor.kt:105)
at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmark(Macrobenchmark.kt:241)
at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmarkWithStartupMode(Macrobenchmark.kt:422)
at androidx.benchmark.macro.junit4.MacrobenchmarkRule.measureRepeated(MacrobenchmarkRule.kt:107)
at androidx.benchmark.macro.junit4.MacrobenchmarkRule.measureRepeated$default(MacrobenchmarkRule.kt:97)
at com.example.macrobenchmark.ExampleStartupBenchmark.startup(ExampleStartupBenchmark.kt:30)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at androidx.benchmark.macro.junit4.MacrobenchmarkRule$applyInternal$1.evaluate(MacrobenchmarkRule.kt:133)
at androidx.test.rule.GrantPermissionRule$RequestPermissionStatement.evaluate(GrantPermissionRule.java:136)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:162)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:67)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:58)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:446)
2024-02-15 16:19:27.774 9069-9099 TestRunner com.example.macrobenchmark E at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2298)
2024-02-15 16:19:27.774 9069-9099 TestRunner com.example.macrobenchmark E ----- end exception -----
2024-02-15 16:19:27.787 9069-9099 TestRunner com.example.macrobenchmark I finished: startup(com.example.macrobenchmark.ExampleStartupBenchmark)
2024-02-15 16:19:27.796 9069-9099 TestRunner com.example.macrobenchmark I run finished: 1 tests, 1 failed, 0 ignored
2024-02-15 16:19:44.858 9792-9792 AndroidRuntime pid-9792 E FATAL EXCEPTION: main
Process: com.app.myapp, PID: 9792
java.lang.RuntimeException: Unable to instantiate application com.game.soulmate.MyApplication package com.app.myapp: java.lang.ClassNotFoundException: Didn't find class "com.game.soulmate.MyApplication" on path: DexPathList[[zip file "/data/app/~~J71UieQOQlumHrcdA8XIpg==/com.app.myapp-Jvagd_AD7yNyuIUNahByDQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~J71UieQOQlumHrcdA8XIpg==/com.app.myapp-Jvagd_AD7yNyuIUNahByDQ==/lib/arm, /data/app/~~J71UieQOQlumHrcdA8XIpg==/com.app.myapp-Jvagd_AD7yNyuIUNahByDQ==/base.apk!/lib/armeabi-v7a, /system/lib, /system/system_ext/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1392)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7183)
at android.app.ActivityThread.access$1800(ActivityThread.java:284)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2284)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:233)
at android.os.Looper.loop(Looper.java:334)
at android.app.ActivityThread.main(ActivityThread.java:8399)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.game.soulmate.MyApplication" on path: DexPathList[[zip file "/data/app/~~J71UieQOQlumHrcdA8XIpg==/com.app.myapp-Jvagd_AD7yNyuIUNahByDQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~J71UieQOQlumHrcdA8XIpg==/com.app.myapp-Jvagd_AD7yNyuIUNahByDQ==/lib/arm, /data/app/~~J71UieQOQlumHrcdA8XIpg==/com.app.myapp-Jvagd_AD7yNyuIUNahByDQ==/base.apk!/lib/armeabi-v7a, /system/lib, /system/system_ext/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76)
at androidx.core.app.CoreComponentFactory.instantiateApplication(Unknown Source:0)
at android.app.Instrumentation.newApplication(Instrumentation.java:1227)
at android.app.LoadedApk.makeApplication(LoadedApk.java:1384)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7183)
at android.app.ActivityThread.access$1800(ActivityThread.java:284)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2284)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:233)
at android.os.Looper.loop(Looper.java:334)
at android.app.ActivityThread.main(ActivityThread.java:8399)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/react/ReactApplication;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 15 more
Caused by: java.lang.ClassNotFoundException: com.facebook.react.ReactApplication
... 18 more
androidx.profileinstaller
library used by the target apk is old. Please use1.3.0-alpha02
or newer. For more information refer to the release notes at