Advanced profiling is unavailable for the selected

2020-08-24 02:28发布

问题:

I'm trying to profile an APK using Android Studio profiler in 3.0. Since I am not on Android 7.0 I have to explicitly turn on advanced profiling in the module config.

The issue is that once this is done, Android Studio is still saying "Advanced profiling is unavailable for the selected process".

The reason I explicitly have to turn this on, is because on API level < 26 Android Studio has to inject some logic into the compiled apk.

To show you advanced profiling data, Android Studio must inject monitoring logic into your compiled app.

https://developer.android.com/studio/preview/features/android-profiler.html

Feedback I got from searching around is that I'm supposed to recompile / rebuild the APK after setting these Run / Debug settings. However I have not been able to find any clear official documentation on this.

But let's assume that it's the case, how would I do this since I don't have access to the source code (obviously).

You might be inclined to say that source code would be required to do this, but I'd like to hear why Android 8.0 is able to do this straight out of the box.

Standard profiling is working without any issue as well.

Would it be possible to inject the logic needed manually?