0

I'm trying to setup AWS Cognito in an Android project. I am able to use the library fine when using Mono, but it breaks with the below error when using IL2CPP as my scripting backend. The error occurs in both NuGet installation as well as installation through the repository following the steps in the official blog

2022-09-27 15:40:27.130 7228 7365 Error Unity NotSupportedException: System.Configuration.ConfigurationManager::get_AppSettings
2022-09-27 15:40:27.130 7228 7365 Error Unity   at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <00000000000000000000000000000000>:0 
2022-09-27 15:40:27.130 7228 7365 Error Unity   at Amazon.AWSConfigs.GetConfig (System.String name) [0x00000] in <00000000000000000000000000000000>:0 
2022-09-27 15:40:27.130 7228 7365 Error Unity   at Amazon.AWSConfigs..cctor () [0x00000] in <00000000000000000000000000000000>:0 
2022-09-27 15:40:27.130 7228 7365 Error Unity   at Amazon.Runtime.ClientConfig..ctor () [0x00000] in <00000000000000000000000000000000>:0 
2022-09-27 15:40:27.130 7228 7365 Error Unity   at Amazon.CognitoIdentity.AmazonCognitoIdentityConfig..ctor () [0x00000] in <00000000000000000000000000000000>:0 
2022-09-27 15:40:27.130 7228 7365 Error Unity   at Amazon.CognitoIdentity.AmazonCognitoIdentityClient..ctor (Amazon.Runtime.AWSCredentials credentials, Amazon.RegionEndpoint region) [0x00000] in <00000000000000000000000000000000>:0 
2022-09-27 15:40:27.130 7228 7365 Error Unity   at Amazon.CognitoIdentity.CognitoAWSCredentials..ctor (System.String accountId, System.String identityPoolId, System.String unAuthRoleArn, System.String authRoleArn, Amazon.RegionEndpoint region) [0x00000] in <000000000000000000000000000

I have tried following the below sources to fix it, but nothing seems to help

  • Added UsedOnlyForAOTCodeGeneration method in one of my GameObjects
  • Added .NET 4.X DLLs and link.xml as mentioned in the official tutorial
  • Added awsconfig.xml as suggested here
  • Changed com.unity3d.player.UnityPlayerNativeActivity to com.unity3d.player.UnityPlayerActivity in AndroidManifest.xml and other changes mentioned in the same blog post

How can I setup the AWS Cognito Identity SDK to run in `Unity 2021.3.7 with Il2cpp as Scripting Backend?

Repro repo: https://github.com/reeganroy/unitycognitoerror

More information Unity: 2021.3.7 API Compatibility Level: .NET Framework SDK: AWSSDK.CognitoIdentity.3.7.0.213 link.xml:

<linker>
  <assembly fullname="System.Core">
    <type fullname="System.Linq.Expressions.Interpreter.LightLambda" preserve="all" />
  </assembly>
  <assembly fullname="AWSSDK.Core" preserve="all"/>
  <assembly fullname="AWSSDK.CognitoIdentity" preserve="all"/>
  <assembly fullname="AWSSDK.Kinesis" preserve="all"/>
  <assembly fullname="AWSSDK.SecurityToken" preserve="all"/>
  <assembly fullname="AWSSDK.CognitoIdentityProvider" preserve="all"/>
  <assembly fullname="Amazon.Extensions.CognitoAuthentication" preserve="all"/>
  <assembly fullname="AWSSDK.PersonalizeEvents" preserve="all"/>
  <assembly fullname="AWSSDK.PersonalizeRuntime" preserve="all"/>
</linker>

0 Answers0