Skip to content

Commit

Permalink
[tests] Preserve more Java types in Xamarin.Forms sample (#2403)
Browse files Browse the repository at this point in the history
Commit 4bb4b2e introduced a crash in our
`Xamarin.Forms-Performance-Integration` test, crashing in the middle
of app startup, because the r8 linker is enabled.

The same happens when ProGuard is enabled in Xamarin.Forms apps;
see also: xamarin/Xamarin.Forms#2709

It looks like we need to preserve the `android.support.v7.view.**`
classes to avoid 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
  • Loading branch information
radekdoulik authored and jonpryor committed Nov 7, 2018
1 parent 376bfa1 commit 6a48423
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
-keep class android.support.v7.widget.** { *; }
-dontwarn android.support.v7.widget.*
-keep class android.support.v7.view.** { *; }
-dontwarn android.support.v7.view.*

0 comments on commit 6a48423

Please sign in to comment.