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

[tests] Preserve more java classes in XForms sample #2403

Conversation

radekdoulik
Copy link
Member

https://github.com/xamarin/xamarin-android/pull/2019/files introduced a crash in our
XForms test, it crashes in the middle of the startup.

It looks like we need to preserve also android.support.v7.view.**
classes as well.

This is the logcat output of the crash:

E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: Xamarin.Forms_Performance_Integration, PID: 8563
E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity}: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class android.support.v7.view.menu.ActionMenuItemView
E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
E AndroidRuntime:        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
E AndroidRuntime:        at android.os.Looper.loop(Looper.java:193)
E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6669)
E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class android.support.v7.view.menu.ActionMenuItemView
E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.v7.view.menu.ActionMenuItemView
E AndroidRuntime: Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
E AndroidRuntime:        at java.lang.Class.getConstructor0(Class.java:2327)
E AndroidRuntime:        at java.lang.Class.getConstructor(Class.java:1725)
E AndroidRuntime:        at android.view.LayoutInflater.createView(LayoutInflater.java:615)
E AndroidRuntime:        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
E AndroidRuntime:        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
E AndroidRuntime:        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
E AndroidRuntime:        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
E AndroidRuntime:        at android.support.v7.view.menu.BaseMenuPresenter.createItemView(:1)
E AndroidRuntime:        at android.support.v7.view.menu.BaseMenuPresenter.getItemView(:3)
E AndroidRuntime:        at android.support.v7.widget.ActionMenuPresenter.getItemView(:3)
E AndroidRuntime:        at android.support.v7.widget.ActionMenuPresenter.flagActionItems(:21)
E AndroidRuntime:        at android.support.v7.view.menu.MenuBuilder.flagActionItems(:6)
E AndroidRuntime:        at android.support.v7.view.menu.BaseMenuPresenter.updateMenuView(:3)
E AndroidRuntime:        at android.support.v7.widget.ActionMenuPresenter.updateMenuView(:1)
E AndroidRuntime:        at android.support.v7.view.menu.MenuBuilder.dispatchPresenterUpdate(:6)
E AndroidRuntime:        at android.support.v7.view.menu.MenuBuilder.onItemsChanged(:4)
E AndroidRuntime:        at android.support.v7.view.menu.MenuBuilder.onItemActionRequestChanged(:2)
E AndroidRuntime:        at android.support.v7.view.menu.MenuItemImpl.setShowAsAction(:3)
E AndroidRuntime:        at xamarin.forms.performance.integration.MainActivity.n_onCreate(Native Method)
E AndroidRuntime:        at xamarin.forms.performance.integration.MainActivity.onCreate(:1)
E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7136)
E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7127)
E AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
E AndroidRuntime:        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
E AndroidRuntime:        at android.os.Looper.loop(Looper.java:193)
E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6669)
E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
W ActivityManager:   Force finishing activity Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity

https://github.com/xamarin/xamarin-android/pull/2019/files introduced a crash in our
XForms test, it crashes in the middle of the startup.

It looks like we need to preserve also android.support.v7.view.**
classes as well.

This is the logcat output of the crash:

    E AndroidRuntime: FATAL EXCEPTION: main
    E AndroidRuntime: Process: Xamarin.Forms_Performance_Integration, PID: 8563
    E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity}: android.view.InflateException: Binary XML file line dotnet#17: Binary XML file line dotnet#17: Error inflating class android.support.v7.view.menu.ActionMenuItemView
    E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
    E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
    E AndroidRuntime:        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
    E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
    E AndroidRuntime:        at android.os.Looper.loop(Looper.java:193)
    E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6669)
    E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
    E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
    E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line dotnet#17: Binary XML file line dotnet#17: Error inflating class android.support.v7.view.menu.ActionMenuItemView
    E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line dotnet#17: Error inflating class android.support.v7.view.menu.ActionMenuItemView
    E AndroidRuntime: Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
    E AndroidRuntime:        at java.lang.Class.getConstructor0(Class.java:2327)
    E AndroidRuntime:        at java.lang.Class.getConstructor(Class.java:1725)
    E AndroidRuntime:        at android.view.LayoutInflater.createView(LayoutInflater.java:615)
    E AndroidRuntime:        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
    E AndroidRuntime:        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
    E AndroidRuntime:        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
    E AndroidRuntime:        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
    E AndroidRuntime:        at android.support.v7.view.menu.BaseMenuPresenter.createItemView(:1)
    E AndroidRuntime:        at android.support.v7.view.menu.BaseMenuPresenter.getItemView(:3)
    E AndroidRuntime:        at android.support.v7.widget.ActionMenuPresenter.getItemView(:3)
    E AndroidRuntime:        at android.support.v7.widget.ActionMenuPresenter.flagActionItems(:21)
    E AndroidRuntime:        at android.support.v7.view.menu.MenuBuilder.flagActionItems(:6)
    E AndroidRuntime:        at android.support.v7.view.menu.BaseMenuPresenter.updateMenuView(:3)
    E AndroidRuntime:        at android.support.v7.widget.ActionMenuPresenter.updateMenuView(:1)
    E AndroidRuntime:        at android.support.v7.view.menu.MenuBuilder.dispatchPresenterUpdate(:6)
    E AndroidRuntime:        at android.support.v7.view.menu.MenuBuilder.onItemsChanged(:4)
    E AndroidRuntime:        at android.support.v7.view.menu.MenuBuilder.onItemActionRequestChanged(:2)
    E AndroidRuntime:        at android.support.v7.view.menu.MenuItemImpl.setShowAsAction(:3)
    E AndroidRuntime:        at xamarin.forms.performance.integration.MainActivity.n_onCreate(Native Method)
    E AndroidRuntime:        at xamarin.forms.performance.integration.MainActivity.onCreate(:1)
    E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7136)
    E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7127)
    E AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
    E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
    E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
    E AndroidRuntime:        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
    E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
    E AndroidRuntime:        at android.os.Looper.loop(Looper.java:193)
    E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6669)
    E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
    E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
    W ActivityManager:   Force finishing activity Xamarin.Forms_Performance_Integration/xamarin.forms.performance.integration.MainActivity
Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

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

Hmm, I tested this at one point, but #2019 was open for a long time. I got past the crash with the original proguard rules somehow?

Do we need to make the build fail if this app crashes?

@radekdoulik
Copy link
Member Author

Yup, I think I will try to query, whether it runs using adb shell pidof Xamarin.Forms_Performance_Integration

@jonpryor
Copy link
Member

jonpryor commented Nov 7, 2018

The worrying question is: why specifically is this change needed?

Rephrased: Wouldn't this impact all Xamarin.Forms users who use r8/d8? In which case, doesn't this change need to be applied within src/Xamarin.Android.Build.Tasks, so that all Xamarin.Forms users don't need to manually apply this proguard.cfg change?

Or do "normal" Forms users not use @(ProguardConfiguration), and thus it isn't a problem?

@jonathanpeppers
Copy link
Member

I think this problem isn't the d8 PR, but using Xamarin.Forms with either proguard or r8.

I think the plan here is that Xamarin.Forms will soon start shipping it's own proguard configuration: xamarin/Xamarin.Forms#2709

I don't know when that will happen?

@jonpryor jonpryor merged commit 6a48423 into dotnet:master Nov 7, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants