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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix VerifyError when optimized code is instrumented #619

Merged
merged 5 commits into from
Dec 28, 2023

Conversation

markushi
Copy link
Member

@markushi markushi commented Dec 28, 2023

馃摐 Description

App startup instrumentation fails for some pre-bundled libraries due to bytecode optimizations which produce non spec-compliant JVM bytecode.

As an example the stack frame variable of member functions at index 0 is not a this reference anymore.
This mainly affects ContentProvider instrumentation as those (opposed to Application classes) are usually shipped within libraries.

Affected Examples:

  • com.google.mlkit.common.internal.MlKitInitProvider
  • androidx.startup.InitializationProvider

馃挕 Motivation and Context

Fixes #618

馃挌 How did you test it?

Manual testing

馃摑 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

馃敭 Next steps

override fun onMethodEnter() {
super.onMethodEnter()
// add local variables, this seems to confuse the optimizer enough
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃槄

Copy link
Member

@stefanosiano stefanosiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's release a hotfix and check if the user issue is gone 馃

@markushi markushi merged commit 86948da into main Dec 28, 2023
17 checks passed
@markushi markushi deleted the fix/instrumentation-fails-for-optimized-libs branch December 28, 2023 10:17
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

Successfully merging this pull request may close these issues.

VerifyError crash at app start
2 participants