Skip to content

Encountering test failures in [EnsureAndroidManifestIsUpdated] on a Pixel 2 (8.1.0) #1191

Closed

Description

@pjcollins

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

  1. Remove the Configuration.props import in src/Mono.Android/Test/Mono.Android-Tests.csproj.
  2. 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

http://xqa.blob.core.windows.net/gist/log-69e5c8740623410ea01f63ff0e2f27bb.txt

Activity

  1. added
    Area: Unit Tests
    on Jan 12, 2018
  2. jonpryor commented on Jan 12, 2018

    @jonpryor
    Contributor

    It's plausible that the EnsureAndroidManifestIsUpdated() assert is wrong, in that Android.Content.PM.ConfigChanges is 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 within AndroidManifest.xml matches android.apptests.RenamedActivity, which is the "legacy"/pre-MD5 package name value for Android.AppTests.RenamedActivity. The resulting obj/$(Configuration)/android/AndroidManifest.xml should contain:

        <activity android:name="md58588017193585150f38c4c2184bc70c2.RenamedActivity" android:configChanges="keyboardHidden" />

    Note that:

    1. The package name is changed, and
    2. The //activity/@android:configChanges value is unchanged.

    @pjcollins: Is your generated AndroidManifest.xml different?

    What about if you decompile the .apk, e.g. with apktool d?


    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]
    

    Can you provide the unzip -l output for the app.apk? Is there a libreuse-threads.so in there??

  3. pjcollins commented on Jan 12, 2018

    @pjcollins
    MemberAuthor

    @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.

            <activity android:configChanges="keyboardHidden" android:name="md58588017193585150f38c4c2184bc70c2.RenamedActivity"/>

    As for the ThreadReuse failure, libreuse-threads.so is bundled in the apk, with a version for each supported ABI:

         9904  01-12-2018 14:43   lib/arm64-v8a/libreuse-threads.so
        13728  01-12-2018 14:43   lib/armeabi-v7a/libreuse-threads.so
        13724  01-12-2018 14:43   lib/armeabi/libreuse-threads.so
         5476  01-12-2018 14:43   lib/x86/libreuse-threads.so
        10176  01-12-2018 14:43   lib/x86_64/libreuse-threads.so
    
  4. pjcollins commented on Mar 13, 2018

    @pjcollins
    MemberAuthor

    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 Mcc and Mnc are 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.

  5. changed the title [-]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)[/+] on Mar 13, 2018
  6. ghost locked as resolved and limited conversation to collaborators on Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Unit Tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions