hyperledger-archives / aries-mobile-agent-xamarin

Apache License 2.0
38 stars 31 forks source link

Android - The requested pool cannot be opened because it does not have an existing configuration #19

Closed sahil-khanna closed 3 years ago

sahil-khanna commented 3 years ago

Problem Statement When accepting a Credential offer, the error The requested pool cannot be opened because it does not have an existing configuration is thrown on executing the below code

(CredentialRequestMessage credentialRequestMessage, CredentialRecord newCredentialRecord) = await credentialService.CreateRequestAsync(agentContext, Credential.Record.Id);

On investigating, I found that the PoolConfigurator gets an exception (An IO error occurred). Below is the stack trace

at Hyperledger.Aries.Ledger.DefaultPoolService.CreatePoolAsync (System.String poolName, System.String genesisFile) [0x0002d] in D:\a\1\s\src\Hyperledger.Aries\Ledger\DefaultPoolService.cs:59 at SSI.Services.PoolConfigurator.ConfigurePoolsAsync () [0x0023b] in /Users/sahil.khanna/Documents/VisualStudio_Workspace/ssi-mobile-app/SSI/Services/PoolConfigurator.cs:54

Note

horationunez commented 3 years ago

hey @sahil-khanna, the problem you are having is that you are likely running on an Android runtime version that doesn't really grant permission using those attributes anymore (while confirming wrongly that you have them).

This is a due to a change in Android 10/11 that introduces the notion of scoped storage as a new way to secure permissions.. there is a way to request a legacy treatment on these permissions.

Take a look at the changes I proposed here: https://github.com/hyperledger/aries-mobileagent-xamarin/pull/21

sahil-khanna commented 3 years ago

Thanks, @horationunez. The below worked for me

Add the following attribute in the <application/> tag of the AndroidManifest.xml

android:requestLegacyExternalStorage="true"