Bug 13957

Summary: Xamarin.Android Apps are crashing on dual core x86 Devices
Product: Android Reporter: Peter Collins <peter.collins>
Component: GeneralAssignee: Rodrigo Kumpera <kumpera>
Status: RESOLVED FIXED    
Severity: normal CC: ard.bisschop, benjamin, bjorn.coltof, chrisntr, geir.ludvigsen, lavanya.kumari, mono-bugs+monodroid, najirlalani, neilboyd, pj.beaman, tj
Priority: Highest    
Version: 4.8.x   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Bug Depends on: 14011, 14013, 14017, 14019, 14042, 14043, 14045, 14050    
Bug Blocks:    
Attachments: repro case
debug level mono log before crash of xamarin.android initialization on multi-core x86 phone

Description Peter Collins 2013-08-13 11:44:35 UTC
Created attachment 4621 [details]
repro case

This bug is based on desk case 43672: 
https://xamarin.desk.com/agent/case/43672

I'm seeing this issue when building with the shared runtime is disabled, and 'x86' is selected as the only supported ABI. I've added some additional logging and a reproduction case.

Logcat:
https://gist.github.com/pjcollins/02d6895f841e58727eee


Environment Details:
Mono 3.2.1 ((no/f3f789e)
XA 4.8.2-32
Galaxy Tab 3 10.1
Comment 1 Rodrigo Kumpera 2013-08-16 15:19:55 UTC
This project is messed up in many layers.

In release mode it's reinstalling the Mono Shared Runtime every single time and it's shipping with the runtime embedded. This doesn't make sense. 

We should do only only one of those or fail the build because the user picked a broken set of options.
Comment 2 Bjorn Coltof 2013-08-26 11:15:07 UTC
Any updates on this? We have client that has made a sizable investments in Tab 3's and they are not too happy that our app simply does not run on the device
Comment 3 Rodrigo Kumpera 2013-08-27 11:51:26 UTC
*** Bug 12829 has been marked as a duplicate of this bug. ***
Comment 4 T.J. Purtell 2013-08-27 22:48:24 UTC
I am also seeing this issue with Android multi-core x86 device users.  Incidentally, some of the users had devices which have libhoudini (arm emulation library for x86), so I was able to provide them a custom build that **DID NOT** have x86 abi support and they were then able to use the app.  I do really need to be able to include the x86 binaries in a single apk for the Play store, but this helped me deal with the issue in the short term for testing.  Perhaps it will help you as well, I don't know if Tab 3's have that cross-compatibility feature or not (I'd be curious to know).

I have attached a logcat with debug level mono logging enabled.  Note that it exhibits the same error as the original poster's app.

E/mono-rt ( 8163): [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object

E/mono-rt ( 8163): at (wrapper dynamic-method) object.4c0aee22-a470-4bce-8e99-7067987d839e (intptr,object[]) <0x00000>

E/mono-rt ( 8163): at Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) <0x000f5>

E/mono-rt ( 8163): at (wrapper native-to-managed) Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) <0x00043>

E/mono-rt ( 8163):
Comment 5 T.J. Purtell 2013-08-27 22:50:29 UTC
Created attachment 4731 [details]
debug level mono log before crash of xamarin.android initialization on multi-core x86 phone
Comment 6 Geir Ludvigsen 2013-09-04 04:09:08 UTC
We are also having exact same problem as in comment 4.

I had cpu support for armeabi, armeabi-v7a AND x86 checked, and it produced exact same errors in my logcat as above. After I unchecked x86 support, then the app started normally without exceptions.

If I deploy in debug mode in Visual Studio (using the shared runtime) there is no problem, the problem occurs only when I deploy in release mode (not using shared runtime).

The device I am testing on is a Galaxy Tab3 GT-P5210 with Android 4.2.2.
Comment 7 Rodrigo Kumpera 2013-09-05 14:39:45 UTC
This is a build configuration issue.

If I create the same template I cannot reproduce the issue anymore.
Comment 8 Rodrigo Kumpera 2013-09-05 14:41:42 UTC
NM, managed to repro it.
Comment 9 Rodrigo Kumpera 2013-09-06 18:17:49 UTC
The bug has been fixed and will be part of our next release. It will hit the testing channels some time later this month.
Comment 10 Ard 2013-10-01 05:50:03 UTC
Can anybody advise on how this fix can be obtained?
This thing has become a major nuisance for our customers that are currently purchasing hardware as part of the 2014 budget, but can not even test our software on the Galaxy Tab 3 or Asus Memopad.
Comment 11 T.J. Purtell 2013-10-01 13:25:41 UTC
FYI, I tried to use Xamarin.Android 4.8.3 released yesterday and the bugfix appears to not be included.  I have been stuck building without x86 binaries, however, not all x86 androids can perform ARM emulation.  I can run my app (albeit slower) on the Galaxy Tab 3 and some Asus devices (not sure about the Memopad specifically), however, devices like the Lenovo K900 simply can\'t run the app.
Comment 12 Ard 2013-10-02 04:37:30 UTC
So, where is this promised bugfix then?
We have thought of the ARM emulation as well, but it would not help a lot as customers need to test the device first and based on performance they would decide on purchase. Some of our customers say the Tab 2 is already difficult to find/purchase, where other customers already purchased Tab 3's, not expecting our app would not work.
Comment 13 PJ 2013-10-03 14:38:46 UTC
Hi all,

Just wanted to update this bug, sorry for the delay. 'later this month' was a loose estimate from Kumpera in comment 9. 

This fix will be released as part of Xamarin.Android 4.8.3, and it should hit the beta channel by the end of this week.

Xamarin.Android 4.8.3 will hit the stable channel by next Friday barring further blocking issues.

Thank you for your continued patience.
Comment 14 T.J. Purtell 2013-10-05 17:22:07 UTC
Today I rebuilt my app with the new alpha build of 4.8.3 that was available from Xamarin Studio.  I found that my app started correctly. Thank you!