Repository navigation
Closed
Labels
Area: Unit TestsIssues with repo unit tests.
Description
I recently switched over to running the runtime test suite within xamarin-android, and am encountering two failures when running on a Pixel 2 running 8.1.0.
Steps to Reproduce
- Remove the Configuration.props import in src/Mono.Android/Test/Mono.Android-Tests.csproj.
- msbuild /t:Install src/Mono.Android/Test/Mono.Android-Tests.csproj /p:Configuration=Release /p:AndroidSupportedAbis=armeabi;armeabi-v7a;x86;arm64-v8a;x86_64 /p:NdkBuildPath=$(AndroidNdkDirectory)/ndkbuild
Expected Behavior
Actual Behavior
01-12 11:50:01.142 I/mono-stdout( 3300): ApplicationContextIsApp Passed
01-12 11:50:01.171 I/mono-stdout( 3300): EnsureAndroidManifestIsUpdated [FAIL] : Expected: KeyboardHidden
01-12 11:50:01.171 I/mono-stdout( 3300): But was: Mcc, Mnc, KeyboardHidden
01-12 11:50:01.171 I/mono-stdout( 3300):
01-12 11:50:01.172 I/mono-stdout( 3300): at Android.AppTests.ApplicationTest.EnsureAndroidManifestIsUpdated () [0x00031] in <c8c50cc61dcd4b1fa318a7f489fdc96e>:0
01-12 11:50:01.172 I/mono-stdout( 3300): at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
01-12 11:50:01.172 I/mono-stdout( 3300): at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <ee2c54e9207c4774b024c80fa2d34922>:0
01-12 11:50:01.642 I/mono-stdout( 3300): ThreadReuse [FAIL] : Java.Lang.LinkageError : Library reuse-threads not found; tried [/system/lib64/libreuse-threads.so]
01-12 11:50:01.642 I/mono-stdout( 3300): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
01-12 11:50:01.642 I/mono-stdout( 3300): at Java.Interop.JniEnvironment+StaticMethods.CallStaticVoidMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <5ecb1ed1e3ff499c94f6efc40693232f>:0
01-12 11:50:01.642 I/mono-stdout( 3300): at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeVoidMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters) [0x00018] in <5ecb1ed1e3ff499c94f6efc40693232f>:0
01-12 11:50:01.642 I/mono-stdout( 3300): at Java.Lang.JavaSystem.LoadLibrary (System.String libName) [0x00029] in <7533dded87a74c049534c9790f62a68f>:0
01-12 11:50:01.642 I/mono-stdout( 3300): at Java.InteropTests.JnienvTest.ThreadReuse () [0x00000] in :0
01-12 11:50:01.642 I/mono-stdout( 3300): at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
01-12 11:50:01.642 I/mono-stdout( 3300): at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in :0
01-12 11:50:01.642 I/mono-stdout( 3300): --- End of managed Java.Lang.LinkageError stack trace ---
01-12 11:50:01.642 I/mono-stdout( 3300): java.lang.UnsatisfiedLinkError: Library reuse-threads not found; tried [/system/lib64/libreuse-threads.so]
01-12 11:50:01.642 I/mono-stdout( 3300): at java.lang.Runtime.loadLibrary0(Runtime.java:1040)
01-12 11:50:01.642 I/mono-stdout( 3300): at java.lang.System.loadLibrary(System.java:1657)
Version Information
Operating System: Mac OS X 10.13.2
Xamarin.Android 8.2.0-4
[Device] Manufacturer: Google, Model: Pixel 2, Version: 8.1.0, ABI: arm64-v8a, Timezone: America/New_York
Log File
Metadata
Metadata
Assignees
Labels
Area: Unit TestsIssues with repo unit tests.
Activity
jonpryor commentedon Jan 12, 2018
It's plausible that the
EnsureAndroidManifestIsUpdated()assert is wrong, in thatAndroid.Content.PM.ConfigChangesis a[Flags]enum, and the test doesn't take that into consideration.That said, why is it failing? Where are the extra "Mcc, Mnc" flags coming from? The intent of
EnsureAndroidManifestIsUpdated()is to ensure that when renaming types we're consistent, e.g. the<activity/>element withinAndroidManifest.xmlmatchesandroid.apptests.RenamedActivity, which is the "legacy"/pre-MD5 package name value forAndroid.AppTests.RenamedActivity. The resultingobj/$(Configuration)/android/AndroidManifest.xmlshould contain:Note that:
//activity/@android:configChangesvalue is unchanged.@pjcollins: Is your generated
AndroidManifest.xmldifferent?What about if you decompile the
.apk, e.g. withapktool d?Can you provide the
unzip -loutput for the app.apk? Is there alibreuse-threads.soin there??pjcollins commentedon Jan 12, 2018
@jonpryor strangely enough, the generated AndroidManifest in my intermediate output, and the one which is produced via apktool disassembly both contain the expected configChanges value... I see no mention of Mcc or Mnc.
As for the
ThreadReusefailure,libreuse-threads.sois bundled in the apk, with a version for each supported ABI:pjcollins commentedon Mar 13, 2018
I'm no longer able to reproduce the ThreadReuse failure, I'll chalk that one up to a build setup issue. As for the configChanges related issue, it seems that
MccandMncare now included by default in 8.0+. I've searched around a bit for confirmation of this, but the best I could find is this mention here:https://github.com/robolectric/robolectric/blob/master/robolectric/src/test/java/org/robolectric/shadows/ShadowPackageManagerTest.java#L256
I think an appropriate (backwards compatible and hopefully future proof) fix would be to use a bitwise and to check for the presence of
keyboardHidden, rather than requiring an exact match.[-]Encountering test failures in [EnsureAndroidManifestIsUpdated] and [ThreadReuse] on a Pixel 2 (8.1.0)[/-][+]Encountering test failures in [EnsureAndroidManifestIsUpdated] on a Pixel 2 (8.1.0)[/+][Mono.Android-Tests] Fix EnsureAndroidManifestIsUpdated (#1413)
[Mono.Android-Tests] Fix EnsureAndroidManifestIsUpdated (#1413)