Closed realZhangChi closed 3 years ago
I tried to create my Device Test project by referring to Essentials.DeviceTests.
<ItemGroup>
<ProjectReference Include="..\..\..\maui\src\TestUtils\src\DeviceTests\TestUtils.DeviceTests.csproj" />
<ProjectReference Include="..\..\..\maui\src\TestUtils\src\DeviceTests.Runners\TestUtils.DeviceTests.Runners.csproj" />
<ProjectReference Include="..\..\..\maui\src\TestUtils\src\DeviceTests.Runners.SourceGen\TestUtils.DeviceTests.Runners.SourceGen.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
delete the App.xaml
, App.xaml.cs
, MainPage.xaml
, MainPage.xaml.cs
, Platforms\Android\MainActivity.cs
, Platforms\Android\MainApplication.cs
from the Device Test project and modify the MauiProgram.cs
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.ConfigureLifecycleEvents(life =>
{
#if __ANDROID__
life.AddAndroid(android =>
{
android.OnCreate((activity, bundle) =>
Platform.Init(activity, bundle));
android.OnRequestPermissionsResult((activity, requestCode, permissions, grantResults) =>
Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults));
});
#endif
})
.ConfigureTests(new TestOptions
{
Assemblies =
{
typeof(MauiProgram).Assembly
}
})
.UseHeadlessRunner(new HeadlessRunnerOptions
{
RequiresUIContext = true,
})
.UseVisualRunner();
return builder.Build();
}
}
dotnet build -f net6.0-android
to compile.xharness android test --output-directory=out --package-name=com.companyname.Maui.Toolkit.WeChat.DeviceTest --app=bin\Debug\net6.0-android\com.companyname.Maui.Toolkit.WeChat.DeviceTest-Signed.apk
for testingI followed the above steps to test and got TESTS_FAILED.
XHarness command issued: android test --output-directory=out --package-name=com.companyname.Maui.Toolkit.WeChat.DeviceTest --app=bin\Debug\net6.0-android\com.companyname.Maui.Toolkit.WeChat.DeviceTest-Signed.apk
info: Will attempt to run device on detected architecture: 'x86'
info: Active Android device set to serial 'emulator-5554'
info: Waiting for device to be available (max 5 minutes)
info: Attempting to remove apk 'com.companyname.Maui.Toolkit.WeChat.DeviceTest':
info: Successfully uninstalled com.companyname.Maui.Toolkit.WeChat.DeviceTest.
info: Attempting to install C:\Users\Chi\source\repos\Maui.Toolkit\test\Maui.Toolkit.WeChat\Maui.Toolkit.WeChat.DeviceTest\bin\Debug\net6.0-android\com.companyname.Maui.Toolkit.WeChat.DeviceTest-Signed.apk:
info: Successfully installed C:\Users\Chi\source\repos\Maui.Toolkit\test\Maui.Toolkit.WeChat\Maui.Toolkit.WeChat.DeviceTest\bin\Debug\net6.0-android\com.companyname.Maui.Toolkit.WeChat.DeviceTest-Signed.apk.
info: Killing all running processes for 'com.companyname.Maui.Toolkit.WeChat.DeviceTest':
info: Starting default instrumentation class on com.companyname.Maui.Toolkit.WeChat.DeviceTest (exit code 0 == success)
info: Running instrumentation class {default} took 1.2414055 seconds
fail: No value for 'return-code' provided in instrumentation result. This may indicate a crashed test (see log)
info: Wrote current ADB log to C:\Users\Chi\source\repos\Maui.Toolkit\test\Maui.Toolkit.WeChat\Maui.Toolkit.WeChat.DeviceTest\out\adb-logcat-com.companyname.Maui.Toolkit.WeChat.DeviceTest-default.log
fail: Non-success instrumentation exit code: 82, expected: 0
info: Attempting to remove apk 'com.companyname.Maui.Toolkit.WeChat.DeviceTest':
info: Successfully uninstalled com.companyname.Maui.Toolkit.WeChat.DeviceTest.
XHarness exit code: 1 (TESTS_FAILED)
Not sure if my test steps are correct?
This is the log.
--------- beginning of main
10-18 02:37:58.882 209 212 E android.system.suspend@1.0-service: Error opening kernel wakelock stats for: wakeup34: Permission denied
10-18 02:37:58.884 209 212 E android.system.suspend@1.0-service: Error opening kernel wakelock stats for: wakeup35: Permission denied
10-18 02:37:58.879 209 209 W Binder:209_2: type=1400 audit(0.0:781): avc: denied { read } for name="wakeup34" dev="sysfs" ino=19154 scontext=u:r:system_suspend:s0 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=0
10-18 02:37:58.879 209 209 W Binder:209_2: type=1400 audit(0.0:782): avc: denied { read } for name="wakeup35" dev="sysfs" ino=19217 scontext=u:r:system_suspend:s0 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=0
--------- beginning of system
10-18 02:37:58.902 514 560 I ActivityManager: Force stopping com.companyname.Maui.Toolkit.WeChat.DeviceTest appid=10124 user=-1: deletePackageX
10-18 02:37:58.990 424 424 I keystore: clear_uid 10124
10-18 02:37:58.994 514 578 D PackageManager: Instant App installer not found with android.intent.action.INSTALL_INSTANT_APP_PACKAGE
10-18 02:37:58.994 514 578 D PackageManager: Clear ephemeral installer activity
10-18 02:37:58.994 514 578 E PermissionMonitor: unknown permission type: -1for uid: 10124
10-18 02:37:59.002 514 1525 E TaskPersister: File error accessing recents directory (directory doesn't exist?).
10-18 02:37:59.043 514 578 I system_server: Explicit concurrent copying GC freed 58990(2746KB) AllocSpace objects, 9(368KB) LOS objects, 49% free, 10MB/21MB, paused 322us total 46.425ms
10-18 02:37:59.051 514 578 I ActivityManager: Force stopping com.companyname.Maui.Toolkit.WeChat.DeviceTest appid=10124 user=0: pkg removed
10-18 02:37:59.052 6997 6999 I cmd : oneway function results will be dropped but finished with status OK and parcel size 4
10-18 02:37:59.092 809 809 V AvrcpMediaPlayerList: mPackageChangedBroadcastReceiver: action: android.intent.action.PACKAGE_REMOVED
10-18 02:37:59.093 1529 1529 I MediaProvider: Invalidating LocalCallingIdentity cache for package com.companyname.Maui.Toolkit.WeChat.DeviceTest. Reason: package android.intent.action.PACKAGE_REMOVED
10-18 02:37:59.094 514 673 V StorageManagerService: Package com.companyname.Maui.Toolkit.WeChat.DeviceTest does not have legacy storage
10-18 02:37:59.100 514 551 I RoleManagerService: Granting default roles...
10-18 02:37:59.110 514 663 I InputReader: Reconfiguring input devices, changes=KEYBOARD_LAYOUTS |
10-18 02:37:59.115 514 655 I RollbackManager: broadcast=ACTION_PACKAGE_FULLY_REMOVED pkg=com.companyname.Maui.Toolkit.WeChat.DeviceTest
10-18 02:37:59.117 514 560 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 (has extras) } to com.android.gallery3d/.app.PackagesMonitor
10-18 02:37:59.117 514 560 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 (has extras) } to com.android.musicfx/.Compatibility$Receiver
10-18 02:37:59.127 514 751 W BestClock: java.time.DateTimeException: Missing NTP fix
10-18 02:37:59.132 1475 1475 I GeofencerStateMachine: removeGeofences: removeRequest=RemoveGeofencingRequest[REMOVE_ALL packageName=com.companyname.Maui.Toolkit.WeChat.DeviceTest]
10-18 02:37:59.138 514 560 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 (has extras) } to com.google.android.apps.maps/com.google.android.libraries.social.peoplekit.thirdparty.viewcontrollers.ThirdPartyReceiver
10-18 02:37:59.138 514 560 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 (has extras) } to com.google.android.gms/.games.chimera.GamesSystemBroadcastReceiverProxy
10-18 02:37:59.138 514 560 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
10-18 02:37:59.158 514 514 W WifiService: Couldn't get PackageInfo for package:com.companyname.Maui.Toolkit.WeChat.DeviceTest
10-18 02:37:59.158 514 514 D WifiService: Remove settings for package:com.companyname.Maui.Toolkit.WeChat.DeviceTest
10-18 02:37:59.161 514 755 D WifiConfigManager: Remove all networks for app ApplicationInfo{9016ab0 com.companyname.Maui.Toolkit.WeChat.DeviceTest}
10-18 02:37:59.165 1032 1032 D Launcher.Model: package removed received com.companyname.Maui.Toolkit.WeChat.DeviceTest
10-18 02:37:59.169 3120 3120 I abb : StartCommandInProcess(7061636b61676500696e7374616c6c00 package.install. [truncated])
10-18 02:37:59.171 1032 1085 D PackageUpdatedTask: Removing app iconcom.companyname.Maui.Toolkit.WeChat.DeviceTest
10-18 02:37:59.192 1032 1085 D ModelWriter: removing items from db
10-18 02:37:59.192 1032 1085 D ModelWriter: java.lang.Exception
10-18 02:37:59.192 1032 1085 D ModelWriter: at com.android.launcher3.model.ModelWriter.deleteItemsFromDatabase(ModelWriter.java:272)
10-18 02:37:59.192 1032 1085 D ModelWriter: at com.android.launcher3.model.ModelWriter.deleteItemsFromDatabase(ModelWriter.java:262)
10-18 02:37:59.192 1032 1085 D ModelWriter: at com.android.launcher3.model.BaseModelUpdateTask.deleteAndBindComponentsRemoved(BaseModelUpdateTask.java:111)
10-18 02:37:59.192 1032 1085 D ModelWriter: at com.android.launcher3.model.PackageUpdatedTask.execute(PackageUpdatedTask.java:323)
10-18 02:37:59.192 1032 1085 D ModelWriter: at com.android.launcher3.model.BaseModelUpdateTask.run(BaseModelUpdateTask.java:67)
10-18 02:37:59.192 1032 1085 D ModelWriter: at android.os.Handler.handleCallback(Handler.java:938)
10-18 02:37:59.192 1032 1085 D ModelWriter: at android.os.Handler.dispatchMessage(Handler.java:99)
10-18 02:37:59.192 1032 1085 D ModelWriter: at android.os.Looper.loop(Looper.java:223)
10-18 02:37:59.192 1032 1085 D ModelWriter: at android.os.HandlerThread.run(HandlerThread.java:67)
10-18 02:37:59.195 514 514 W WifiService: Couldn't get PackageInfo for package:com.companyname.Maui.Toolkit.WeChat.DeviceTest
10-18 02:37:59.195 514 514 D WifiService: Remove settings for package:com.companyname.Maui.Toolkit.WeChat.DeviceTest
10-18 02:37:59.197 514 514 I ConditionProviders: Disallowing condition provider com.companyname.Maui.Toolkit.WeChat.DeviceTest
10-18 02:37:59.208 514 755 D WifiConfigStore: Writing to stores completed in 44 ms.
10-18 02:37:59.209 514 755 I PasspointManager: No app ops listener found for com.companyname.Maui.Toolkit.WeChat.DeviceTest
10-18 02:37:59.209 514 755 D WifiConfigManager: Remove all networks for app ApplicationInfo{bf02bd1 com.companyname.Maui.Toolkit.WeChat.DeviceTest}
10-18 02:37:59.221 514 751 W BestClock: java.time.DateTimeException: Missing NTP fix
10-18 02:37:59.228 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.233 1170 1170 D CarrierSvcBindHelper: No carrier app for: 0
10-18 02:37:59.234 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.251 514 755 D WifiConfigStore: Writing to stores completed in 41 ms.
10-18 02:37:59.251 514 755 I PasspointManager: No app ops listener found for com.companyname.Maui.Toolkit.WeChat.DeviceTest
10-18 02:37:59.252 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.261 1359 1446 I LatinIME:LogUtils: Dictionary info: dictionary = main:en ; version = 54 ; date = 1414726273
10-18 02:37:59.261 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.268 376 773 I chatty : uid=1041(audioserver) Binder:376_3 identical 1 line
10-18 02:37:59.273 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.276 514 752 W BestClock: java.time.DateTimeException: Missing NTP fix
10-18 02:37:59.280 1475 7015 I Fitness : FitCleanupIntentOperation received Intent android.intent.action.PACKAGE_REMOVED [CONTEXT service_id=17 ]
10-18 02:37:59.290 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.323 514 514 W Binder:514_6: type=1400 audit(0.0:783): avc: denied { getopt } for scontext=u:r:system_server:s0 tcontext=u:r:shell:s0 tclass=unix_stream_socket permissive=0
10-18 02:37:59.355 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.369 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.372 1923 7019 W SQLiteLog: (28) double-quoted string literal: "com.companyname.Maui.Toolkit.WeChat.DeviceTest"
10-18 02:37:59.377 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.384 376 773 I chatty : uid=1041(audioserver) Binder:376_3 identical 1 line
10-18 02:37:59.392 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.403 1923 5702 I Icing : doRemovePackageData com.companyname.Maui.Toolkit.WeChat.DeviceTest [CONTEXT service_id=21 ]
10-18 02:37:59.403 514 752 W BestClock: java.time.DateTimeException: Missing NTP fix
10-18 02:37:59.403 514 759 W BestClock: java.time.DateTimeException: Missing NTP fix
10-18 02:37:59.404 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.404 514 759 W BestClock: java.time.DateTimeException: Missing NTP fix
10-18 02:37:59.422 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.423 514 751 W BestClock: java.time.DateTimeException: Missing NTP fix
10-18 02:37:59.429 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.434 376 773 D AF::TrackHandle: OpPlayAudio: track:55 usage:13 not muted
10-18 02:37:59.443 514 751 W BestClock: java.time.DateTimeException: Missing NTP fix
10-18 02:37:59.447 514 752 W BestClock: java.time.DateTimeException: Missing NTP fix
10-18 02:37:59.462 1529 2289 I MediaProvider: Begin Intent { act=android.intent.action.PACKAGE_FULLY_REMOVED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x5000010 cmp=com.android.providers.media.module/com.android.providers.media.MediaService (has extras) }
10-18 02:37:59.465 514 752 W BestClock: java.time.DateTimeException: Missing NTP fix
10-18 02:37:59.466 514 759 W BestClock: java.time.DateTimeException: Missing NTP fix
10-18 02:37:59.475 1923 7030 I ContentMaintenance: Internal cache bytes used: 0; limit: 100000000; download size: 0
10-18 02:37:59.489 1529 2289 I MediaProvider: End Intent { act=android.intent.action.PACKAGE_FULLY_REMOVED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x5000010 cmp=com.android.providers.media.module/com.android.providers.media.MediaService (has extras) }
10-18 02:37:59.495 514 672 W RuleEvaluation: Integrity rule files are not available.
10-18 02:37:59.499 514 578 I PackageManager: Integrity check passed for file:///data/app/vmdl2094095347.tmp
10-18 02:37:59.502 1923 2393 I Icing : IndexChimeraService.getServiceInterface callingPackage=com.google.android.gms componentName=AppsCorpus serviceId=36 [CONTEXT service_id=21 ]
10-18 02:37:59.539 514 578 D CompatibilityChangeReporter: Compat change id reported: 135549675; UID 10125; state: ENABLED
10-18 02:37:59.563 514 578 D PackageManager: Instant App installer not found with android.intent.action.INSTALL_INSTANT_APP_PACKAGE
10-18 02:37:59.563 514 578 D PackageManager: Clear ephemeral installer activity
10-18 02:37:59.574 514 578 V BackupManagerService: [UserID:0] restoreAtInstall pkg=com.companyname.Maui.Toolkit.WeChat.DeviceTest token=5 restoreSet=0
10-18 02:37:59.574 514 578 V BackupManagerService: [UserID:0] Finishing install immediately
10-18 02:37:59.583 420 642 E installd: Couldn't opendir /data/app/vmdl2094095347.tmp: No such file or directory
10-18 02:37:59.583 420 642 E installd: Failed to delete /data/app/vmdl2094095347.tmp: No such file or directory
10-18 02:37:59.588 3120 3151 I abb : oneway function results will be dropped but finished with status OK and parcel size 4
10-18 02:37:59.591 1923 2418 W Icing : No valid account for uploading user actions [CONTEXT service_id=21 ]
10-18 02:37:59.583 514 514 W Binder:514_6: type=1400 audit(0.0:784): avc: denied { getopt } for scontext=u:r:system_server:s0 tcontext=u:r:shell:s0 tclass=unix_stream_socket permissive=0
10-18 02:37:59.583 514 514 W Binder:514_6: type=1400 audit(0.0:785): avc: denied { getopt } for scontext=u:r:system_server:s0 tcontext=u:r:shell:s0 tclass=unix_stream_socket permissive=0
10-18 02:37:59.594 1923 7030 I RealtimeCacheCleanup: Beginning Realtime garbage collection.
10-18 02:37:59.583 514 514 W Binder:514_6: type=1400 audit(0.0:786): avc: denied { getopt } for scontext=u:r:system_server:s0 tcontext=u:r:shell:s0 tclass=unix_stream_socket permissive=0
10-18 02:37:59.602 1923 7030 I RealtimeCacheCleanup: Finished Realtime garbage collection.
10-18 02:37:59.617 1529 1529 I MediaProvider: Invalidating LocalCallingIdentity cache for package com.companyname.Maui.Toolkit.WeChat.DeviceTest. Reason: package android.intent.action.PACKAGE_ADDED
10-18 02:37:59.623 514 663 I InputReader: Reconfiguring input devices, changes=KEYBOARD_LAYOUTS |
10-18 02:37:59.628 809 809 V AvrcpMediaPlayerList: mPackageChangedBroadcastReceiver: action: android.intent.action.PACKAGE_ADDED
10-18 02:37:59.628 809 809 D AvrcpMediaPlayerList: Name of package changed: com.companyname.Maui.Toolkit.WeChat.DeviceTest
10-18 02:37:59.639 514 1266 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 (has extras) } to com.android.packageinstaller/.PackageInstalledReceiver
10-18 02:37:59.646 514 514 I Telecom : DefaultDialerCache: Refreshing default dialer for user 0: now com.android.dialer: DDC.oR@AKY
10-18 02:37:59.651 514 560 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 (has extras) } to com.android.gallery3d/.app.PackagesMonitor
10-18 02:37:59.652 514 560 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 (has extras) } to com.google.android.gms/.games.chimera.GamesSystemBroadcastReceiverProxy
10-18 02:37:59.653 514 514 V BackupManagerConstants: getFullBackupIntervalMilliseconds(...) returns 86400000
10-18 02:37:59.653 514 514 V BackupManagerConstants: getFullBackupRequiredNetworkType(...) returns 2
10-18 02:37:59.653 514 514 V BackupManagerConstants: getFullBackupRequireCharging(...) returns true
10-18 02:37:59.667 1170 1170 D CarrierSvcBindHelper: No carrier app for: 0
10-18 02:37:59.678 514 560 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 (has extras) } to com.google.android.gms/.gass.chimera.PackageChangeBroadcastReceiver
10-18 02:37:59.685 514 559 W VoiceInteractionManager: no available voice recognition services found for user 0
10-18 02:37:59.686 514 560 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
10-18 02:37:59.699 1923 2418 I Icing : Usage reports ok 0, Failed Usage reports 0, indexed 0, rejected 0 [CONTEXT service_id=21 ]
10-18 02:37:59.702 1923 7025 I Auth : [SupervisedAccountIntentOperation] onHandleIntent(): android.intent.action.PACKAGE_ADDED
10-18 02:37:59.702 1923 7025 I Auth : [SupervisedAccountIntentOperation] This operation is disabled
10-18 02:37:59.703 1923 7029 I ChromeSync: [Sync,SyncIntentOperation] Handling the intent: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 cmp=com.google.android.gms/.chimera.GmsIntentOperationService (has extras) }.
10-18 02:37:59.704 1923 7025 I FontsPackageChangeOp: Package com.companyname.Maui.Toolkit.WeChat.DeviceTest has no metadata
10-18 02:37:59.706 1475 7012 W GCM : Unexpected forwarded intent: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 cmp=com.google.android.gms/.chimera.PersistentIntentOperationService (has extras) }
10-18 02:37:59.706 1475 7013 W GCM : Unexpected forwarded intent: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.Maui.Toolkit.WeChat.DeviceTest flg=0x4000010 cmp=com.google.android.gms/.chimera.PersistentIntentOperationService (has extras) }
10-18 02:37:59.710 1170 1170 D CarrierConfigLoader: mHandler: 9 phoneId: 0
10-18 02:37:59.713 514 1658 W ActivityManager: Unable to start service Intent { act=com.google.android.gms.auth.key.retrieval.service.START pkg=com.google.android.gms } U=0: not found
10-18 02:37:59.717 514 1903 W ActivityManager: Unbind failed: could not find connection for android.os.BinderProxy@8529025
10-18 02:37:59.717 1923 2123 E GmsClient: unable to connect to service: com.google.android.gms.auth.key.retrieval.service.START on com.google.android.gms
10-18 02:37:59.728 846 2970 I PermissionControllerServiceImpl: Updating user sensitive for uid 10125
10-18 02:37:59.734 1923 7029 I ChromeSync: [Persistence,AffiliationManager] One of affiliation or grouping data for android://QUvgElob_ONWnJO2f8enD_XM-Nz0-4-b2fN1TuIyU_5yu9h32I2IGRzJ7s9a2P-t-wnx7dJzjdONJv0vLXjYXg==@com.companyname.Maui.Toolkit.WeChat.DeviceTest/ was not found. Marking affiliation data as stale...
10-18 02:37:59.757 7038 7042 I cmd : oneway function results will be dropped but finished with status OK and parcel size 4
10-18 02:37:59.758 1923 2385 I Icing : IndexChimeraService.getServiceInterface callingPackage=com.google.android.gms componentName=null serviceId=30 [CONTEXT service_id=21 ]
10-18 02:37:59.766 1923 5702 W Icing : No valid account for uploading user actions [CONTEXT service_id=21 ]
10-18 02:37:59.776 1923 5702 I Icing : Usage reports ok 0, Failed Usage reports 0, indexed 0, rejected 0 [CONTEXT service_id=21 ]
10-18 02:38:00.004 831 831 D KeyguardClockSwitch: Updating clock: 2罡?8
10-18 02:38:00.101 514 551 I RoleManagerService: Granting default roles...
10-18 02:38:00.349 7045 7045 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
10-18 02:38:00.359 7045 7045 W app_process: type=1400 audit(0.0:787): avc: denied { read } for name="u:object_r:device_config_runtime_native_boot_prop:s0" dev="tmpfs" ino=10327 scontext=u:r:shell:s0 tcontext=u:object_r:device_config_runtime_native_boot_prop:s0 tclass=file permissive=0
10-18 02:38:00.364 7045 7045 E libc : Access denied finding property "persist.device_config.runtime_native_boot.profilebootclasspath"
10-18 02:38:00.364 7045 7045 E libc : Access denied finding property "persist.device_config.runtime_native_boot.enable_apex_image"
10-18 02:38:00.364 7045 7045 I AndroidRuntime: Using default boot image
--------- beginning of kernel
10-17 14:07:07.259 0 0 W audit : audit_lost=649 audit_rate_limit=5 audit_backlog_limit=64
10-17 14:07:07.260 0 0 E audit : rate limit exceeded
10-18 02:38:00.368 7045 7045 E libc : Access denied finding property "persist.device_config.runtime_native_boot.disable_lock_profiling"
10-18 02:38:00.369 7045 7045 I AndroidRuntime: Leaving lock profiling enabled
10-18 02:38:00.369 7045 7045 E libc : Access denied finding property "persist.device_config.runtime_native_boot.enable_generational_cc"
10-18 02:38:00.363 7045 7045 W app_process: type=1400 audit(0.0:788): avc: denied { read } for name="u:object_r:device_config_runtime_native_boot_prop:s0" dev="tmpfs" ino=10327 scontext=u:r:shell:s0 tcontext=u:object_r:device_config_runtime_native_boot_prop:s0 tclass=file permissive=0
10-18 02:38:00.380 7045 7045 I app_process: Core platform API reporting enabled, enforcing=false
10-18 02:38:00.562 7045 7045 D app_process: Time zone APEX ICU file found: /apex/com.android.tzdata/etc/icu/icu_tzdata.dat
10-18 02:38:00.563 7045 7045 D app_process: I18n APEX ICU file found: /apex/com.android.i18n/etc/icu/icudt66l.dat
10-18 02:38:00.592 7045 7045 W app_process: Unexpected CPU variant for X86 using defaults: x86
10-18 02:38:00.598 7045 7045 I app_process: The ClassLoaderContext is a special shared library.
10-18 02:38:00.660 7045 7045 W app_process: JNI RegisterNativeMethods: attempt to register 0 native methods for android.media.AudioAttributes
10-18 02:38:00.681 7045 7045 D AndroidRuntime: Calling main entry com.android.commands.am.Am
10-18 02:38:00.703 1923 5702 I Icing : Indexing com.google.android.gms-apps from com.google.android.gms [CONTEXT service_id=21 ]
10-18 02:38:00.708 1923 5702 I Icing : Indexing done com.google.android.gms-apps [CONTEXT service_id=21 ]
10-18 02:38:00.713 7045 7045 D AndroidRuntime: Shutting down VM
10-18 02:38:00.756 1923 5702 I Icing : Indexing com.google.android.gms-apps from com.google.android.gms [CONTEXT service_id=21 ]
10-18 02:38:00.757 1923 5702 I Icing : Indexing done com.google.android.gms-apps [CONTEXT service_id=21 ]
10-17 14:07:11.101 0 0 D logd : logdr: UID=2000 GID=2000 PID=7061 n tail=0 logMask=99 pid=0 start=0ns timeout=0ns
After changing the package name to lowercase and adding permissions to AndroidManifest, I ran the command xharness android test --output-directory=out --package-name=com.companyname.maui.toolkit.wechat.devicetest --app=bin\Debug\net6.0-android\com.companyname.maui.toolkit.wechat.devicetest-Signed.apk --instrumentation=com.companyname.maui.toolkit.wechat.devicetest.TestInstrumentation --verbosity=Debug
and got the result Process crashed
.
......
info: Starting instrumentation class 'com.companyname.maui.toolkit.wechat.devicetest.TestInstrumentation' on com.companyname.maui.toolkit.wechat.devicetest
dbug: Raw command: 'shell am instrument -w com.companyname.maui.toolkit.wechat.devicetest/com.companyname.maui.toolkit.wechat.devicetest.TestInstrumentation'
dbug: Executing command: 'C:\Users\Chi\.dotnet\tools\.store\microsoft.dotnet.xharness.cli\1.0.0-prerelease.21511.3\microsoft.dotnet.xharness.cli\1.0.0-prerelease.21511.3\runtimes\any\native\adb\windows\adb.exe -s emulator-5554 shell am instrument -w com.companyname.maui.toolkit.wechat.devicetest/com.companyname.maui.toolkit.wechat.devicetest.TestInstrumentation'
info: Running instrumentation class com.companyname.maui.toolkit.wechat.devicetest.TestInstrumentation took 0.7255557 seconds
dbug: Exit code: 0
Standard Output:
INSTRUMENTATION_RESULT: shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0
info: Short Message:
Process crashed.
fail: No value for 'return-code' provided in instrumentation result. This may indicate a crashed test (see log)
dbug: Executing command: 'C:\Users\Chi\.dotnet\tools\.store\microsoft.dotnet.xharness.cli\1.0.0-prerelease.21511.3\microsoft.dotnet.xharness.cli\1.0.0-prerelease.21511.3\runtimes\any\native\adb\windows\adb.exe -s emulator-5554 logcat -d '
info: Wrote current ADB log to C:\Users\Chi\source\repos\Maui.Toolkit\test\Maui.Toolkit.WeChat\Maui.Toolkit.WeChat.DeviceTest\out\adb-logcat-com.companyname.maui.toolkit.wechat.devicetest-com.companyname.maui.toolkit.wechat.devicetest.TestInstrumentation.log
dbug: Executing command: 'C:\Users\Chi\.dotnet\tools\.store\microsoft.dotnet.xharness.cli\1.0.0-prerelease.21511.3\microsoft.dotnet.xharness.cli\1.0.0-prerelease.21511.3\runtimes\any\native\adb\windows\adb.exe -s emulator-5554 bugreport C:\Users\Chi\source\repos\Maui.Toolkit\test\Maui.Toolkit.WeChat\Maui.Toolkit.WeChat.DeviceTest\out\adb-bugreport-com.companyname.maui.toolkit.wechat.devicetest.zip'
info: Wrote ADB bugreport to C:\Users\Chi\source\repos\Maui.Toolkit\test\Maui.Toolkit.WeChat\Maui.Toolkit.WeChat.DeviceTest\out\adb-bugreport-com.companyname.maui.toolkit.wechat.devicetest.zip
fail: Non-success instrumentation exit code: 82, expected: 0
info: Attempting to remove apk 'com.companyname.maui.toolkit.wechat.devicetest':
dbug: Executing command: 'C:\Users\Chi\.dotnet\tools\.store\microsoft.dotnet.xharness.cli\1.0.0-prerelease.21511.3\microsoft.dotnet.xharness.cli\1.0.0-prerelease.21511.3\runtimes\any\native\adb\windows\adb.exe -s emulator-5554 uninstall com.companyname.maui.toolkit.wechat.devicetest'
info: Successfully uninstalled com.companyname.maui.toolkit.wechat.devicetest.
XHarness exit code: 1 (TESTS_FAILED)
This is the log.
--------- beginning of system
10-18 06:19:10.480 529 581 W PackageManager: Not removing non-existent package com.companyname.maui.toolkit.wechat.devicetest
--------- beginning of main
10-18 06:19:10.523 3176 3176 I abb : StartCommandInProcess(7061636b61676500696e7374616c6c00 package.install. [truncated])
10-18 06:19:10.568 529 529 W Binder:529_10: type=1400 audit(0.0:351): avc: denied { getopt } for scontext=u:r:system_server:s0 tcontext=u:r:shell:s0 tclass=unix_stream_socket permissive=0
10-18 06:19:10.642 529 640 W RuleEvaluation: Integrity rule files are not available.
10-18 06:19:10.643 529 581 I PackageManager: Integrity check passed for file:///data/app/vmdl492600847.tmp
10-18 06:19:10.659 529 581 D CompatibilityChangeReporter: Compat change id reported: 135549675; UID 10128; state: ENABLED
10-18 06:19:10.684 529 581 D PackageManager: Instant App installer not found with android.intent.action.INSTALL_INSTANT_APP_PACKAGE
10-18 06:19:10.684 529 581 D PackageManager: Clear ephemeral installer activity
10-18 06:19:10.685 529 549 V StorageManagerService: Package null does not have legacy storage
10-18 06:19:10.686 1340 12208 I MediaProvider: Invalidating LocalCallingIdentity cache for package com.companyname.maui.toolkit.wechat.devicetest. Reason: op android:read_external_storage
10-18 06:19:10.691 529 581 V BackupManagerService: [UserID:0] restoreAtInstall pkg=com.companyname.maui.toolkit.wechat.devicetest token=8 restoreSet=0
10-18 06:19:10.691 529 581 V BackupManagerService: [UserID:0] Finishing install immediately
10-18 06:19:10.686 1340 12208 I chatty : uid=10114(com.android.providers.media.module) Binder:1340_4 identical 1 line
10-18 06:19:10.687 1340 12208 I MediaProvider: Invalidating LocalCallingIdentity cache for package com.companyname.maui.toolkit.wechat.devicetest. Reason: op android:read_external_storage
10-18 06:19:10.693 427 427 E installd: Couldn't opendir /data/app/vmdl492600847.tmp: No such file or directory
10-18 06:19:10.693 427 427 E installd: Failed to delete /data/app/vmdl492600847.tmp: No such file or directory
10-18 06:19:10.695 3176 3180 I abb : oneway function results will be dropped but finished with status OK and parcel size 4
10-18 06:19:10.692 529 529 W Binder:529_10: type=1400 audit(0.0:352): avc: denied { getopt } for scontext=u:r:system_server:s0 tcontext=u:r:shell:s0 tclass=unix_stream_socket permissive=0
10-18 06:19:10.701 1340 1340 I MediaProvider: Invalidating LocalCallingIdentity cache for package com.companyname.maui.toolkit.wechat.devicetest. Reason: package android.intent.action.PACKAGE_ADDED
10-18 06:19:10.692 529 529 W Binder:529_10: type=1400 audit(0.0:353): avc: denied { getopt } for scontext=u:r:system_server:s0 tcontext=u:r:shell:s0 tclass=unix_stream_socket permissive=0
10-18 06:19:10.703 529 549 I RoleManagerService: Granting default roles...
10-18 06:19:10.692 529 529 W Binder:529_10: type=1400 audit(0.0:354): avc: denied { getopt } for scontext=u:r:system_server:s0 tcontext=u:r:shell:s0 tclass=unix_stream_socket permissive=0
10-18 06:19:10.711 529 631 I InputReader: Reconfiguring input devices, changes=KEYBOARD_LAYOUTS |
10-18 06:19:10.717 705 705 V AvrcpMediaPlayerList: mPackageChangedBroadcastReceiver: action: android.intent.action.PACKAGE_ADDED
10-18 06:19:10.717 705 705 D AvrcpMediaPlayerList: Name of package changed: com.companyname.maui.toolkit.wechat.devicetest
10-18 06:19:10.717 529 2858 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.maui.toolkit.wechat.devicetest flg=0x4000010 (has extras) } to com.android.packageinstaller/.PackageInstalledReceiver
10-18 06:19:10.731 529 558 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.maui.toolkit.wechat.devicetest flg=0x4000010 (has extras) } to com.android.gallery3d/.app.PackagesMonitor
10-18 06:19:10.732 529 558 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.maui.toolkit.wechat.devicetest flg=0x4000010 (has extras) } to com.google.android.gms/.games.chimera.GamesSystemBroadcastReceiverProxy
10-18 06:19:10.733 529 558 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.maui.toolkit.wechat.devicetest flg=0x4000010 (has extras) } to com.google.android.gms/.gass.chimera.PackageChangeBroadcastReceiver
10-18 06:19:10.733 529 558 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.maui.toolkit.wechat.devicetest flg=0x4000010 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
10-18 06:19:10.747 2123 2142 I PermissionControllerServiceImpl: Updating user sensitive for uid 10128
10-18 06:19:10.749 529 529 I Telecom : DefaultDialerCache: Refreshing default dialer for user 0: now com.android.dialer: DDC.oR@AJg
10-18 06:19:10.755 529 529 V BackupManagerConstants: getFullBackupIntervalMilliseconds(...) returns 86400000
10-18 06:19:10.755 529 529 V BackupManagerConstants: getFullBackupRequiredNetworkType(...) returns 2
10-18 06:19:10.756 529 529 V BackupManagerConstants: getFullBackupRequireCharging(...) returns true
10-18 06:19:10.765 529 557 W VoiceInteractionManager: no available voice recognition services found for user 0
10-18 06:19:10.782 1218 16394 W GCM : Unexpected forwarded intent: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.maui.toolkit.wechat.devicetest flg=0x4000010 cmp=com.google.android.gms/.chimera.PersistentIntentOperationService (has extras) }
10-18 06:19:10.784 1218 16394 W GCM : Unexpected forwarded intent: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.maui.toolkit.wechat.devicetest flg=0x4000010 cmp=com.google.android.gms/.chimera.PersistentIntentOperationService (has extras) }
10-18 06:19:10.786 933 933 D CarrierSvcBindHelper: No carrier app for: 0
10-18 06:19:10.787 529 3070 W ActivityManager: Unable to start service Intent { act=com.google.android.gms.auth.key.retrieval.service.START pkg=com.google.android.gms } U=0: not found
10-18 06:19:10.787 1567 16402 I Auth : [SupervisedAccountIntentOperation] onHandleIntent(): android.intent.action.PACKAGE_ADDED
10-18 06:19:10.788 1567 16404 I ChromeSync: [Sync,SyncIntentOperation] Handling the intent: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.companyname.maui.toolkit.wechat.devicetest flg=0x4000010 cmp=com.google.android.gms/.chimera.GmsIntentOperationService (has extras) }.
10-18 06:19:10.789 529 2173 W ActivityManager: Unbind failed: could not find connection for android.os.BinderProxy@5e2fe50
10-18 06:19:10.794 1567 16402 I FontsPackageChangeOp: Package com.companyname.maui.toolkit.wechat.devicetest has no metadata
10-18 06:19:10.796 1567 1697 E GmsClient: unable to connect to service: com.google.android.gms.auth.key.retrieval.service.START on com.google.android.gms
10-18 06:19:10.808 933 933 D CarrierConfigLoader: mHandler: 9 phoneId: 0
10-18 06:19:10.846 1567 16404 I ChromeSync: [Persistence,AffiliationManager] One of affiliation or grouping data for android://QUvgElob_ONWnJO2f8enD_XM-Nz0-4-b2fN1TuIyU_5yu9h32I2IGRzJ7s9a2P-t-wnx7dJzjdONJv0vLXjYXg==@com.companyname.maui.toolkit.wechat.devicetest/ was not found. Marking affiliation data as stale...
10-18 06:19:10.874 1567 16391 E ConfigFileUtils: Failed to read config file: /data/user_de/0/com.google.android.gms/app_chimera/next_container.pb: open failed: ENOENT (No such file or directory)
10-18 06:19:10.886 529 539 I system_server: Background concurrent copying GC freed 70705(3647KB) AllocSpace objects, 23(1524KB) LOS objects, 49% free, 12MB/25MB, paused 692us total 192.917ms
10-18 06:19:10.897 1567 2013 I Icing : IndexChimeraService.getServiceInterface callingPackage=com.google.android.gms componentName=AppsCorpus serviceId=36 [CONTEXT service_id=21 ]
10-18 06:19:10.906 1567 16391 I ChmraDebugLogger: [73] 1801
10-18 06:19:10.909 1567 16391 I ChmraDebugLogger: [30] [Pay.optional:201817020000] permitMetered=true,
10-18 06:19:10.915 1567 16391 W ChimeraConfigService: Retry attempt was throttled.
10-18 06:19:10.925 1567 7798 W Icing : No valid account for uploading user actions [CONTEXT service_id=21 ]
10-18 06:19:10.959 1567 7798 I Icing : Usage reports ok 0, Failed Usage reports 0, indexed 0, rejected 0 [CONTEXT service_id=21 ]
10-18 06:19:10.963 1567 2013 I Icing : IndexChimeraService.getServiceInterface callingPackage=com.google.android.gms componentName=null serviceId=30 [CONTEXT service_id=21 ]
10-18 06:19:10.971 1567 1892 I Icing : IndexChimeraService.getServiceInterface callingPackage=com.google.android.gms componentName=null serviceId=36 [CONTEXT service_id=21 ]
10-18 06:19:10.971 1567 7798 I Icing : Indexing com.google.android.gms-apps from com.google.android.gms [CONTEXT service_id=21 ]
10-18 06:19:10.995 1567 7798 W Icing : No valid account for uploading user actions [CONTEXT service_id=21 ]
10-18 06:19:11.004 1567 7798 I Icing : Usage reports ok 0, Failed Usage reports 0, indexed 0, rejected 0 [CONTEXT service_id=21 ]
10-18 06:19:11.009 1567 7798 W Icing : No valid account for uploading user actions [CONTEXT service_id=21 ]
10-18 06:19:11.018 1567 7798 I Icing : Usage reports ok 0, Failed Usage reports 0, indexed 0, rejected 0 [CONTEXT service_id=21 ]
10-18 06:19:11.020 1567 7798 I Icing : Indexing done com.google.android.gms-apps [CONTEXT service_id=21 ]
10-18 06:19:11.020 1567 7798 I Icing : Indexing com.google.android.gms-internal.3p:MobileApplication from com.google.android.gms [CONTEXT service_id=21 ]
10-18 06:19:11.029 1567 7798 I Icing : Indexing done com.google.android.gms-internal.3p:MobileApplication [CONTEXT service_id=21 ]
10-18 06:19:11.047 16420 16420 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
10-18 06:19:11.048 16420 16420 W app_process: type=1400 audit(0.0:355): avc: denied { read } for name="u:object_r:device_config_runtime_native_boot_prop:s0" dev="tmpfs" ino=1224 scontext=u:r:shell:s0 tcontext=u:object_r:device_config_runtime_native_boot_prop:s0 tclass=file permissive=0
10-18 06:19:11.049 16420 16420 E libc : Access denied finding property "persist.device_config.runtime_native_boot.profilebootclasspath"
10-18 06:19:11.049 16420 16420 E libc : Access denied finding property "persist.device_config.runtime_native_boot.enable_apex_image"
10-18 06:19:11.049 16420 16420 I AndroidRuntime: Using default boot image
10-18 06:19:11.049 16420 16420 E libc : Access denied finding property "persist.device_config.runtime_native_boot.disable_lock_profiling"
10-18 06:19:11.049 16420 16420 I AndroidRuntime: Leaving lock profiling enabled
10-18 06:19:11.053 16420 16420 E libc : Access denied finding property "persist.device_config.runtime_native_boot.enable_generational_cc"
10-18 06:19:11.055 16420 16420 I app_process: Core platform API reporting enabled, enforcing=false
--------- beginning of kernel
10-18 06:19:11.031 0 0 W audit : audit_lost=8 audit_rate_limit=5 audit_backlog_limit=64
10-18 06:19:11.031 0 0 E audit : rate limit exceeded
10-18 06:19:11.048 16420 16420 W app_process: type=1400 audit(0.0:356): avc: denied { read } for name="u:object_r:device_config_runtime_native_boot_prop:s0" dev="tmpfs" ino=1224 scontext=u:r:shell:s0 tcontext=u:object_r:device_config_runtime_native_boot_prop:s0 tclass=file permissive=0
10-18 06:19:11.048 16420 16420 W app_process: type=1400 audit(0.0:357): avc: denied { read } for name="u:object_r:device_config_runtime_native_boot_prop:s0" dev="tmpfs" ino=1224 scontext=u:r:shell:s0 tcontext=u:object_r:device_config_runtime_native_boot_prop:s0 tclass=file permissive=0
10-18 06:19:11.098 16420 16420 D app_process: Time zone APEX ICU file found: /apex/com.android.tzdata/etc/icu/icu_tzdata.dat
10-18 06:19:11.099 16420 16420 D app_process: I18n APEX ICU file found: /apex/com.android.i18n/etc/icu/icudt66l.dat
10-18 06:19:11.102 16420 16420 W app_process: Unexpected CPU variant for X86 using defaults: x86
10-18 06:19:11.104 16420 16420 I app_process: The ClassLoaderContext is a special shared library.
10-18 06:19:11.115 16420 16420 W app_process: JNI RegisterNativeMethods: attempt to register 0 native methods for android.media.AudioAttributes
10-18 06:19:11.118 16420 16420 D AndroidRuntime: Calling main entry com.android.commands.am.Am
10-18 06:19:11.121 529 2858 I ActivityManager: Force stopping com.companyname.maui.toolkit.wechat.devicetest appid=10128 user=0: start instr
10-18 06:19:11.123 529 2858 D CompatibilityChangeReporter: Compat change id reported: 135634846; UID 10128; state: DISABLED
10-18 06:19:11.124 529 559 D CompatibilityChangeReporter: Compat change id reported: 143937733; UID 10128; state: ENABLED
10-18 06:19:11.129 288 288 D Zygote : Forked child process 16435
10-18 06:19:11.131 529 559 I ActivityManager: Start proc 16435:com.companyname.maui.toolkit.wechat.devicetest/u0a128 for added application com.companyname.maui.toolkit.wechat.devicetest
10-18 06:19:11.137 16435 16435 I chat.devicetes: Late-enabling -Xcheck:jni
10-18 06:19:11.145 16435 16435 I chat.devicetes: Unquickening 12 vdex files!
10-18 06:19:11.145 16435 16435 W chat.devicetes: Unexpected CPU variant for X86 using defaults: x86
10-18 06:19:11.155 393 416 I adbd : jdwp connection from 16435
10-18 06:19:11.242 16435 16435 D NetworkSecurityConfig: No Network Security Config specified, using platform default
10-18 06:19:11.243 16435 16435 D NetworkSecurityConfig: No Network Security Config specified, using platform default
10-18 06:19:11.246 16435 16435 D debug-app-helper: Checking if libmonodroid was unpacked to /data/app/~~aAYw_Nl02YQsmQ7NzusN6w==/com.companyname.maui.toolkit.wechat.devicetest-AMmILHcZijyomdC_4zEMAQ==/lib/x86/libmonodroid.so
10-18 06:19:11.246 16435 16435 D debug-app-helper: Native libs extracted to /data/app/~~aAYw_Nl02YQsmQ7NzusN6w==/com.companyname.maui.toolkit.wechat.devicetest-AMmILHcZijyomdC_4zEMAQ==/lib/x86, assuming application/android:extractNativeLibs == true
10-18 06:19:11.246 16435 16435 I debug-app-helper: Setting up for DSO lookup in app data directories
10-18 06:19:11.246 16435 16435 D debug-app-helper: Added filesystem DSO lookup location: /data/app/~~aAYw_Nl02YQsmQ7NzusN6w==/com.companyname.maui.toolkit.wechat.devicetest-AMmILHcZijyomdC_4zEMAQ==/lib/x86
10-18 06:19:11.246 16435 16435 W debug-app-helper: Using runtime path: /data/app/~~aAYw_Nl02YQsmQ7NzusN6w==/com.companyname.maui.toolkit.wechat.devicetest-AMmILHcZijyomdC_4zEMAQ==/lib/x86
10-18 06:19:11.246 16435 16435 W debug-app-helper: checking directory: `/data/user/0/com.companyname.maui.toolkit.wechat.devicetest/files/.__override__/lib`
10-18 06:19:11.246 16435 16435 W debug-app-helper: directory does not exist: `/data/user/0/com.companyname.maui.toolkit.wechat.devicetest/files/.__override__/lib`
10-18 06:19:11.246 16435 16435 W debug-app-helper: Checking whether Mono runtime exists at: /data/user/0/com.companyname.maui.toolkit.wechat.devicetest/files/.__override__/libmonosgen-2.0.so
10-18 06:19:11.246 16435 16435 W debug-app-helper: Checking whether Mono runtime exists at: /data/app/~~aAYw_Nl02YQsmQ7NzusN6w==/com.companyname.maui.toolkit.wechat.devicetest-AMmILHcZijyomdC_4zEMAQ==/lib/x86/libmonosgen-2.0.so
10-18 06:19:11.246 16435 16435 I debug-app-helper: Mono runtime found at: /data/app/~~aAYw_Nl02YQsmQ7NzusN6w==/com.companyname.maui.toolkit.wechat.devicetest-AMmILHcZijyomdC_4zEMAQ==/lib/x86/libmonosgen-2.0.so
10-18 06:19:11.247 16435 16435 W chat.devicetes: Attempt to remove non-JNI local reference, dumping thread
10-18 06:19:11.247 16435 16435 I DOTNET : JNI_OnLoad: JNI_OnLoad in pal_jni.c
10-18 06:19:11.250 16435 16435 W monodroid: Creating public update directory: `/data/user/0/com.companyname.maui.toolkit.wechat.devicetest/files/.__override__`
10-18 06:19:11.250 16435 16435 W chat.devicetes: Attempt to remove non-JNI local reference, dumping thread
10-18 06:19:11.250 16435 16435 W monodroid: runtime args empty
10-18 06:19:11.251 16435 16435 F monodroid: No assemblies found in '/data/user/0/com.companyname.maui.toolkit.wechat.devicetest/files/.__override__' or '<unavailable>'. Assuming this is part of Fast Deployment. Exiting...
10-18 06:19:11.259 529 3096 I ActivityManager: Process com.companyname.maui.toolkit.wechat.devicetest (pid 16435) has died: fg FGS
10-18 06:19:11.259 288 288 I Zygote : Process 16435 exited cleanly (65)
10-18 06:19:11.259 529 560 I libprocessgroup: Successfully killed process cgroup uid 10128 pid 16435 in 0ms
10-18 06:19:11.259 529 3096 W ActivityManager: Crash of app com.companyname.maui.toolkit.wechat.devicetest running instrumentation ComponentInfo{com.companyname.maui.toolkit.wechat.devicetest/com.companyname.maui.toolkit.wechat.devicetest.TestInstrumentation}
10-18 06:19:11.260 529 3096 I ActivityManager: Force stopping com.companyname.maui.toolkit.wechat.devicetest appid=10128 user=0: finished inst
10-18 06:19:11.262 16420 16420 D AndroidRuntime: Shutting down VM
10-18 06:19:13.868 1218 16358 E WakeLock: GCM_HB_ALARM release without a matched acquire!
10-18 06:19:13.868 1218 16358 W WakeLock: GCM_HB_ALARM counter does not exist
10-18 06:19:13.871 529 658 D ConnectivityService: reportNetworkConnectivity(101, false) by 10087
10-18 06:19:13.872 855 2727 D NetworkMonitor/101: Forcing reevaluation for UID 10087. Dns signal count: 3
10-18 06:19:13.872 1218 16358 E WakeLock: GCM_CONN_ALARM release without a matched acquire!
10-18 06:19:13.872 1218 16358 W WakeLock: GCM_CONN_ALARM counter does not exist
10-18 06:19:13.895 855 16460 D NetworkMonitor/101: PROBE_DNS www.google.com 21ms OK 108.160.163.117,2001::42dc:9b0c
10-18 06:19:14.178 855 16460 D NetworkMonitor/101: PROBE_HTTPS https://www.google.com/generate_204 time=282ms ret=204 request={Connection=[close], User-Agent=[Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.32 Safari/537.36]} headers={null=[HTTP/1.1 204 No Content], Alt-Svc=[h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"], Connection=[close], Content-Length=[0], Date=[Mon, 18 Oct 2021 06:19:13 GMT], X-Android-Received-Millis=[1634537954177], X-Android-Response-Source=[NETWORK 204], X-Android-Selected-Protocol=[http/1.1], X-Android-Sent-Millis=[1634537954118]}
10-18 06:19:14.183 855 16459 D NetworkMonitor/101: isCaptivePortal: isSuccessful()=true isPortal()=false RedirectUrl=null isPartialConnectivity()=false Time=307ms
10-18 06:19:14.183 529 558 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.net.conn.NETWORK_CONDITIONS_MEASURED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
10-18 06:19:14.185 529 658 D ConnectivityService: [101 WIFI] validation passed
10-18 06:19:14.720 0 0 D logd : logdr: UID=2000 GID=2000 PID=16467 n tail=0 logMask=99 pid=0 start=0ns timeout=0ns
Hi @realZhangChi,
Please note that the test
command expects the app to have a TestRunner which is a XUnit test runner wrapper that you can find in this repository. This TestRunner will locate unit tests inside of the app and connect to the XHarness process to signalize the progress.
Does your app have a TestRunner? If not, you can try the android run
command which just runs the application and checks its exit code.
However, I haven't tried running MAUI apps yet, @mattleibow might have some experience there.
Hi @premun , thanks for your reply!
Yes, my app has a custom TestRunner, which inherits from AndroidApplicationEntryPoint
.
I recreated a Maui project and performed the following minimum reproduction steps.
Microsoft.DotNet.XHarness.TestRunners.Xunit
.Create a HeadlessTestRunner
class and inherit from AndroidApplicationEntryPoint
, as follows
public class HeadlessTestRunner : AndroidApplicationEntryPoint
{
readonly string _resultsPath;
public override TextWriter Logger => null;
public override string TestsResultsFinalPath => _resultsPath;
protected override int? MaxParallelThreads => System.Environment.ProcessorCount;
protected override IDevice Device => new TestDevice();
public HeadlessTestRunner(string testResultsFileName)
{
var cache = Application.Context.CacheDir!.AbsolutePath;
_resultsPath = Path.Combine(cache, testResultsFileName);
}
protected override IEnumerable<TestAssemblyInfo> GetTestAssemblies()
{
var assembly = typeof(MauiProgram).Assembly;
var path = Path.Combine(Application.Context.CacheDir!.AbsolutePath, assembly.GetName().Name + ".dll");
if (!File.Exists(path))
File.Create(path).Close();
yield return new TestAssemblyInfo(assembly, path);
}
protected override void TerminateWithSuccess()
{
}
public async Task<Bundle> RunTestsAsync()
{
var bundle = new Bundle();
TestsCompleted += OnTestsCompleted;
await RunAsync();
TestsCompleted -= OnTestsCompleted;
if (File.Exists(TestsResultsFinalPath))
bundle.PutString("test-results-path", TestsResultsFinalPath);
if (bundle.GetLong("return-code", -1) == -1)
bundle.PutLong("return-code", 1);
return bundle;
void OnTestsCompleted(object sender, TestRunResult results)
{
var message =
$"Tests run: {results.ExecutedTests} " +
$"Passed: {results.PassedTests} " +
$"Inconclusive: {results.InconclusiveTests} " +
$"Failed: {results.FailedTests} " +
$"Ignored: {results.SkippedTests}";
bundle.PutString("test-execution-summary", message);
bundle.PutLong("return-code", results.FailedTests == 0 ? 0 : 1);
}
}
}
Create a MauiTestInstrumentation
class as follows
[Instrumentation(Name = "com.companyname.xharnesssample.MauiTestInstrumentation")]
public class MauiTestInstrumentation : Instrumentation
{
public IServiceProvider Services { get; private set; } = null!;
public override async void OnStart()
{
base.OnStart();
Services = MauiApplication.Current.Services;
var bundle = await RunTestsAsync();
Finish(Result.Ok, bundle);
}
Task<Bundle> RunTestsAsync()
{
var runner = Services.GetRequiredService<HeadlessTestRunner>();
return runner.RunTestsAsync();
}
}
xharness android test --output-directory=out --package-name=com.companyname.xharnesssample --app=bin\Debug\net6.0-android\com.companyname.xharnesssample-Signed.apk --instrumentation=com.companyname.xharnesssample.MauiTestInstrumentation --verbosity=Debug
I still end up getting the same error,
......
info: Running instrumentation class com.companyname.xharnesssample.MauiTestInstrumentation took 0.7311008 seconds
dbug: Exit code: 0
Standard Output:
INSTRUMENTATION_RESULT: shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0
info: Short Message:
Process crashed.
fail: No value for 'return-code' provided in instrumentation result. This may indicate a crashed test (see log)
......
fail: Non-success instrumentation exit code: 82, expected: 0
Am I missing some key steps?
This is the github repository for the project: XHarnessSample
@premun Thank you very much for your help! I figured out what the problem was. In the adb-logcat I found the following logs
10-18 06:19:11.251 16435 16435 F monodroid: No assemblies found in '/data/user/0/com.companyname.maui.toolkit.wechat.devicetest/files/.__override__' or '<unavailable>'. Assuming this is part of Fast Deployment. Exiting...
10-18 06:19:11.259 529 3096 I ActivityManager: Process com.companyname.maui.toolkit.wechat.devicetest (pid 16435) has died: fg FGS
10-18 06:19:11.259 288 288 I Zygote : Process 16435 exited cleanly (65)
Because I compiled the project using the dotnet build
command, the resulting apk file does not contain the complete assembly.
When I compile the project with dotnet build -p:EmbedAssembliesIntoApk=true
, everything works fine! :tada:
Hi, I would like to create Device Test project for my Maui project, but there is very little information about it now. Is there a tutorial for using XHarness in Maui? Any help is appreciated. Thanks.