aws-samples / aws-sdk-unity-samples

This repository has samples that demonstrate various aspects of the AWS Mobile SDK for Unity, you can get the SDK source on Github (https://github.com/aws/aws-sdk-net)
Other
160 stars 107 forks source link

MobileAnalytics Sample nullpointer exception #19

Open Boivin92 opened 8 years ago

Boivin92 commented 8 years ago

Hi,

First time using AWS and I'm trying to use the mobile analytics but I can't seem to make it work on either IOS nor Android. I followed the tutorial by the letter, making sure everything was exactly like the tutorial asks and I still can't make it work. Here's the IOS exception being thrown on load:

NullReferenceException: A null value was found where an object instance was required.
  at Amazon.AWSConfigs.GetSection[T] (System.String sectionName) [0x00000] in <filename unknown>:0 
  at Amazon.Util.Internal.RootConfig..ctor () [0x00000] in <filename unknown>:0 
  at Amazon.AWSConfigs..cctor () [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.Internal.Util.Logger.ConfigureLoggers () [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.Internal.Util.Logger..ctor (System.Type type) [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.Internal.Util.Logger.GetLogger (System.Type type) [0x00000] in <filename unknown>:0 
  at Amazon.UnityInitializer.Awake () [0x00000] in <filename unknown>:0 
  at UnityEngine.GameObject.AddComponent[T] () [0x00000] in <filename unknown>:0 
  at Amazon.UnityInitializer.AttachToGameObject (UnityEngine.GameObject gameObject) [0x00000] in <filename unknown>:0 
  at AWSSDK.Examples.AmazonMobileAnalyticsSample.Start () [0x00000] in <filename unknown>:0 
Rethrow as TypeInitializationException: The type initializer for 'Amazon.AWSConfigs' threw an exception.
  at Amazon.Runtime.Internal.Util.Logger.ConfigureLoggers () [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.Internal.Util.Logger..ctor (System.Type type) [0x00000] in <filename unknown>:0 
  at Amazon.Runtime.Internal.Util.Logger.GetLogger (System.Type type) [0x00000] in <filename unknown>:0 
  at Amazon.UnityInitializer.Awake () [0x00000] in <filename unknown>:0 
  at UnityEngine.GameObject.AddComponent[T] () [0x00000] in <filename unknown>:0 
  at Amazon.UnityInitializer.AttachToGameObject (UnityEngine.GameObject gameObject) [0x00000] in <filename unknown>:0 
  at AWSSDK.Examples.AmazonMobileAnalyticsSample.Start () [0x00000] in <filename unknown>:0 
Rethrow as TypeInitializationException: The type initializer for 'Amazon.Util.Internal.AmazonHookedPlatformInfo' threw an exception.
  at Amazon.UnityInitializer.Awake () [0x00000] in <filename unknown>:0 
  at UnityEngine.GameObject.AddComponent[T] () [0x00000] in <filename unknown>:0 
  at Amazon.UnityInitializer.AttachToGameObject (UnityEngine.GameObject gameObject) [0x00000] in <filename unknown>:0 
  at AWSSDK.Examples.AmazonMobileAnalyticsSample.Start () [0x00000] in <filename unknown>:0 
UnityEngine.GameObject:AddComponent()
Amazon.UnityInitializer:AttachToGameObject(GameObject)
AWSSDK.Examples.AmazonMobileAnalyticsSample:Start()

(Filename: currently not available on il2cpp Line: -1)

Attached unity initializer to AmazonMobileAnalyticsSample
UnityEngine.Logger:Log(LogType, Object)
AWSSDK.Examples.AmazonMobileAnalyticsSample:Start()

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

NullReferenceException: A null value was found where an object instance was required.
  at Amazon.AWSConfigs.set_EndpointDefinition (System.String value) [0x00000] in <filename unknown>:0 
  at Amazon.RegionEndpoint.LoadEndpointDefinitions () [0x00000] in <filename unknown>:0 
  at Amazon.RegionEndpoint.GetBySystemName (System.String systemName) [0x00000] in <filename unknown>:0 
  at AWSSDK.Examples.AmazonMobileAnalyticsSample.Start () [0x00000] in <filename unknown>:0 

(Filename: currently not available on il2cpp Line: -1)

And just in case I did something wrong, here's the link.xml file, located in the Assets folder root

<linker>
    <!-- if you are using AWSConfigs.HttpClient.UnityWebRequest option-->

<assembly fullname="UnityEngine">
    <type fullname="UnityEngine.Experimental.Networking.UnityWebRequest" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.UploadHandlerRaw" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.UploadHandler" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.DownloadHandler" preserve="all" />
    <type fullname="UnityEngine.Experimental.Networking.DownloadHandlerBuffer" preserve="all" />
</assembly>

<assembly fullname="mscorlib">
    <namespace fullname="System.Security.Cryptography" preserve="all"/>
</assembly>

<assembly fullname="System">
    <namespace fullname="System.Security.Cryptography" preserve="all"/>
</assembly>

<assembly fullname="AWSSDK.Core" preserve="all"/>
<assembly fullname="AWSSDK.CognitoIdentity" preserve="all"/>
<assembly fullname="AWSSDK.SecurityToken" preserve="all"/>
<assembly fullname="AWSSDK.MobileAnalytics" preserve="all"/>
</linker>

and the awsconfig.xml, located in Assets/Resources

<?xml version="1.0" encoding="utf-8"?>
<aws> 
    region="us-east-1"
    <logging>
        logTo="UnityLogger"             
        logResponses="Always"             
        logMetrics="true"
        logMetricsFormat="JSON" 
    </logging>
</aws>

the rest of the project is untouched except for my poolID and my appID. I'm on Unity 5.3.5f1

karthiksaligrama commented 8 years ago

your awsconfig.xml is malformed try

<?xml version="1.0" encoding="utf-8"?>
<aws
    region="us-east-1">
    <logging
        logTo="UnityLogger"             
        logResponses="Always"             
        logMetrics="true"
        logMetricsFormat="JSON" 
    </logging>
</aws>