1

I am trying to use baseline profile generated and run benchmark test. Despite copying baseline profile, I am still facing issues. I copied it in all variant folders just to make sure its not missed, still getting file not found exception.

java.lang.RuntimeException: No baseline profile was found in the target apk.
    at androidx.benchmark.macro.CompilationMode$Partial.compileImpl$benchmark_macro_release(CompilationMode.kt:339)
    at androidx.benchmark.macro.CompilationMode.resetAndCompile$benchmark_macro_release(CompilationMode.kt:76)
    at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmark(Macrobenchmark.kt:139)
    at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmarkWithStartupMode(Macrobenchmark.kt:301)
    at androidx.benchmark.macro.junit4.MacrobenchmarkRule.measureRepeated(MacrobenchmarkRule.kt:106)
    at androidx.benchmark.macro.junit4.MacrobenchmarkRule.measureRepeated$default(MacrobenchmarkRule.kt:96)
    at com.example.mobile.android.beta.benchmark.exampleStartupBenchmark.startup(ExampleStartupBenchmark.kt:44)
    at com.example.mobile.android.beta.benchmark.exampleStartupBenchmark.startUpCompilationModePartial(ExampleStartupBenchmark.kt:35)


02-03 16:51:28.498  9721  9721 D ProfileInstaller: Installing profile for com.example.mobile.android.beta.test
02-03 16:51:28.499  9721  9780 V FA      : Connecting to remote service
02-03 16:51:28.501  9721  9721 E ProfileInstaller: RESULT_BASELINE_PROFILE_NOT_FOUND
02-03 16:51:28.501  9721  9721 E ProfileInstaller: java.io.FileNotFoundException: dexopt/baseline.prof
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at android.content.res.AssetManager.nativeOpenAsset(Native Method)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at android.content.res.AssetManager.open(AssetManager.java:904)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at android.content.res.AssetManager.open(AssetManager.java:881)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at androidx.profileinstaller.DeviceProfileWriter.read(DeviceProfileWriter.java:163)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at androidx.profileinstaller.ProfileInstaller.transcodeAndWrite(ProfileInstaller.java:434)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at androidx.profileinstaller.ProfileInstaller.writeProfile(ProfileInstaller.java:565)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at androidx.profileinstaller.ProfileInstallReceiver.onReceive(ProfileInstallReceiver.java:104)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at android.app.ActivityThread.handleReceiver(ActivityThread.java:4306)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2153)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at android.os.Handler.dispatchMessage(Handler.java:106)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at android.os.Looper.loopOnce(Looper.java:201)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at android.os.Looper.loop(Looper.java:288)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at android.app.ActivityThread.main(ActivityThread.java:7872)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at java.lang.reflect.Method.invoke(Native Method)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
02-03 16:51:28.501  9721  9721 E ProfileInstaller:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)example

base line profile added in main Even after adding baseline profile to main, it still gives me error.

Manoj MM
  • 480
  • 1
  • 5
  • 15
  • Do you have `androidx.profileinstaller:profileinstaller` in `app/build.gradle`? – ConstOrVar Feb 03 '23 at 13:05
  • @ConstOrVar Yes. //Baseline profiler implementation "androidx.profileinstaller:profileinstaller:1.2.2" I even tried with alpha version. – Manoj MM Feb 03 '23 at 13:50
  • @ConstOrVar I've different flavors Just FYI – Manoj MM Feb 03 '23 at 14:21
  • Can you provide build.gradle for `app` and `benchmark` modules with lib versions used? – ConstOrVar Feb 08 '23 at 07:42
  • Pls what version of AGP are you using? AGP 8.0+ is only capable of leveraging baseline profiles in different variants, the older version only accepts it in src/main (which I see you have though). – mlykotom Feb 08 '23 at 18:27
  • Also, you can check with the APK Analyzer (Build -> Analyze APK) whether you have the built profile in dexopt/baseline.prof – mlykotom Mar 01 '23 at 09:50

0 Answers0