Marc-Antoine Therrien
Marc-Antoine Therrien

Reputation: 11

What is the source of this error: does not have a signature matching the target?

I am trying to make some uitests work. I am using visual studio 2017. I am developing a cross-platform app using .net c# xamarin. It is not a form project.

I already tried to deploy my app with and without a signed apk but the error is still triggered. First, I was having this: Timed out waiting for the result of ClearAppData2 when running Xamarin UI Tests for Android, but I realized that I forgot to include Xamarin.UITest package. When I added this, I got the error below. On the ADB prompt, I can successfully uninstall com.xxx.yyy and com.xxx.yyy.test. I feel like my uitest set is trying to open com.xxx.yyy.test, but I have nothing like that on my phone (nothing that I can see). I have look for any com.xxx.yyy.test definition all over my app and nothing. The error is thrown at :

return ConfigureApp
    .Android
    .Debug()
    .EnableLocalScreenshots()
    .InstalledApp("com.xxx.yyy")
    .StartApp();

I am using those packages :

<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.14.0" />
<PackageReference Include="UITests.Helpers.Uno" Version="1.3.0" />
<PackageReference Include="Uno.Injectable" Version="1.32.0" />
<PackageReference Include="Uno.MonoAnalyzers" Version="1.0.0">
   <PrivateAssets>all</PrivateAssets>
   <IncludeAssets>runtime; build; native; contentfiles; 
   analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Uno.SourceGenerationTasks" Version="1.31.0" />
<PackageReference Include="Xamarin.UITest" Version="3.0.3" />

The error thrown :

Message: OneTimeSetUp: System.Exception : Failed to execute: C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -s ZY323RTCJ8 shell am instrument com.xxx.yyy.test/sh.calaba.instrumentationbackend.ClearAppData2 - exit code: 1 java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{com.xxx.yyy.test/sh.calaba.instrumentationbackend.ClearAppData2} from pid=8893, uid=8893 not allowed because package com.xxx.yyy.test does not have a signature matching the target com.xxx.yyy

Upvotes: 1

Views: 1244

Answers (1)

sajmons
sajmons

Reputation: 258

App on your device com.xxx.yyy is not signed with the same certificate as test app com.xxx.yyy.test.

Change your code like this:

return ConfigureApp
    .Android
    .KeyStore("pathToKeyStore", "storePassword", "keyPassword", "keyAllias")
    .Debug()
    .EnableLocalScreenshots()
    .InstalledApp("com.xxx.yyy")
    .StartApp();

Upvotes: 3

Related Questions