Error when running on device: Object reference not set to an instance of an object

0 votes

Hi, I'm integrating App42 plugin on Unity to made a Leaderboard for my game, I followed this tutorial: http://api.shephertz.com/tutorial/Managing-Leaderboard/?index=gameApp-leaderboard and I managed to have a Player's facebook friends leaderboard running, It works very well when I run my game on Unity Editor, but when I build the APK and install the game on my device, It doesn't work.

I'm using Unity 5.2.2p3 Personal, Mac OS X 10.11.2 and App42_Unity3D_SDK 4.1.2

I have a GameObject in my Splash Screen with the following code to initialize App42:

    void Start ()
    {
        try {
            DebugTextUI.Log ("Loagind APP42..");
            App42Log.SetDebug (true);
            App42API.Initialize (
                "My_API_Key",
                "My_Secret_Key");
            gameService = App42API.BuildGameService ();
            scoreBoardService = App42API.BuildScoreBoardService ();
            SplashScreen.LoadSplash.Invoke (1);
            DebugTextUI.Log ("App42 Loaded...");
        } catch (Exception ex) {
            DebugTextUI.Log (ex.Message);
        }
    }

So this is the SplashScreen running on UnityEditor:

And this is the SplashScreen rinnung on device:

So as you can see, after writing the log "Loading APP42..." there's an error that doesn't happend when running on UnityEditor.

 

This is the what I get with LogCat when I made a Development Build:

12-16 14:04:32.377: D/Unity(9482): Platform assembly: /data/app/com.mostroapps.dinok2demo-1/base.apk/assets/bin/Data/Managed/App42-Unity3D-SDK-4.1.2.dll (this message is harmless)
12-16 14:04:32.378: D/Unity(9482): Loading /data/app/com.mostroapps.dinok2demo-1/base.apk/assets/bin/Data/Managed/App42-Unity3D-SDK-4.1.2.dll into Unity Child Domain
12-16 14:04:34.409: I/Unity(9482): LeaderboardData:Start() (at /Users/mostroapps/mostro/unity/dragonX/Assets/Scripts/LeaderBoards/App42/LeaderboardData.cs:38)
12-16 14:04:34.434: I/Unity(9482): Loagind APP42..
12-16 14:04:34.434: I/Unity(9482): LeaderboardApp42:Start()
12-16 14:04:34.439: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.App42Log:Console(String)
12-16 14:04:34.439: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.Config:.ctor()
12-16 14:04:34.439: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.Config:GetInstance()
12-16 14:04:34.439: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.App42API:.cctor()
12-16 14:04:34.439: I/Unity(9482): LeaderboardApp42:Start() (at /Users/mostroapps/mostro/unity/dragonX/Assets/Scripts/LeaderBoards/App42/LeaderboardApp42.cs:61)
12-16 14:04:34.439: I/Unity(9482): LeaderboardApp42:Start() (at /Users/mostroapps/mostro/unity/dragonX/Assets/Scripts/LeaderBoards/App42/LeaderboardApp42.cs:54)
12-16 14:04:34.439: I/Unity(9482): (Filename: /Users/mostroapps/mostro/unity/dragonX/Assets/Scripts/LeaderBoards/App42/LeaderboardApp42.cs Line: 61)
12-16 14:04:34.599: I/Unity(9482):  Json String : {"app42":{"event":{"eventName":"INSTALL","methodName":"_TRACKEVENT_","app42_lastCommunicatedAt":"","superProperties":{"app42_brand":"<unknown>","app42_os_version":"Android OS 5.1 / API-22 (LPE23.32-14.2/3)","app42_screen_dpi":480,"app42_screen_height":1080,"app42_screen_width":1920,"app42_os":"Android OS 5.1 / API-22 (LPE23.32-14.2/3)","app42_model":"motorola XT1097","app42_lastCommunicatedAt":"","app42_counter":1},"userProperties":""}}}
12-16 14:04:34.599: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.App42Log:Console(String)
12-16 14:04:34.599: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.app42Event.EventService:TrackEventInternal(String, Dictionary`2, App42CallBack)
12-16 14:04:34.599: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.app42Event.EventServiceUtils:FireInstallEvent(String, String)
12-16 14:04:34.599: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.App42API:Initialize(String, String)
12-16 14:04:34.599: I/Unity(9482): LeaderboardApp42:Start() (at /Users/mostroapps/mostro/unity/dragonX/Assets/Scripts/LeaderBoards/App42/LeaderboardApp42.cs:51)
12-16 14:04:34.625: I/Unity(9482): apiKeyMY_API_KEYbody{"app42":{"event":{"eventName":"INSTALL","methodName":"_TRACKEVENT_","app42_lastCommunicatedAt":"","superProperties":{"app42_brand":"<unknown>","app42_os_version":"Android OS 5.1 / API-22 (LPE23.32-14.2/3)","app42_screen_dpi":480,"app42_screen_height":1080,"app42_screen_width":1920,"app42_os":"Android OS 5.1 / API-22 (LPE23.32-14.2/3)","app42_model":"motorola XT1097","app42_lastCommunicatedAt":"","app42_counter":1},"userProperties":""}}}timeStamp2015-12-16T19:04:34.465Zversion1.0
12-16 14:04:34.625: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.App42Log:Console(String)
12-16 14:04:34.625: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.util.Util:SortAndConvertTableToString(Dictionary`2)
12-16 14:04:34.625: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.util.Util:Sign(String, Dictionary`2)
12-16 14:04:34.625: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.app42Event.EventService:TrackEventInternal(String, Dictionary`2, App42CallBack)
12-16 14:04:34.625: I/Unity(9482): com.shephertz.app42.paas.sdk.csharp.app42E
12-16 14:04:34.653: I/Unity(9482): LeaderboardApp42:Start() (at /Users/mostroapps/mostro/unity/dragonX/Assets/Scripts/LeaderBoards/App42/LeaderboardApp42.cs:59)



But when I run the game using the Development Build on device, it crashes, so I build a Production build and this is what I get fro LogCat: 

12-16 14:10:01.338: I/Unity(13472): Loagind APP42..
12-16 14:10:01.493: I/Unity(13472):  Json String : {"app42":{"event":{"eventName":"INSTALL","methodName":"_TRACKEVENT_","app42_lastCommunicatedAt":"","superProperties":{"app42_brand":"<unknown>","app42_os_version":"Android OS 5.1 / API-22 (LPE23.32-14.2/3)","app42_screen_dpi":480,"app42_screen_height":1080,"app42_screen_width":1920,"app42_os":"Android OS 5.1 / API-22 (LPE23.32-14.2/3)","app42_model":"motorola XT1097","app42_lastCommunicatedAt":"","app42_counter":1},"userProperties":""}}}
12-16 14:10:01.511: I/Unity(13472): apiKeyMY_API_KEYbody{"app42":{"event":{"eventName":"INSTALL","methodName":"_TRACKEVENT_","app42_lastCommunicatedAt":"","superProperties":{"app42_brand":"<unknown>","app42_os_version":"Android OS 5.1 / API-22 (LPE23.32-14.2/3)","app42_screen_dpi":480,"app42_screen_height":1080,"app42_screen_width":1920,"app42_os":"Android OS 5.1 / API-22 (LPE23.32-14.2/3)","app42_model":"motorola XT1097","app42_lastCommunicatedAt":"","app42_counter":1},"userProperties":""}}}timeStamp2015-12-16T19:10:01.366Zversion1.0

(I changed my API_KEY from the logs)

and the game doesn't crash, so I don't know how to make App42 API Plugin works when I build my game to install on device.

Can you help me?

asked Dec 16, 2015 in App42 Cloud API-BaaS by mostrolabs (15 points)
edited Dec 16, 2015 by mostrolabs

1 Answer

0 votes
 
Best answer
Hello Mostrolabs,

Have you enabled stripping level while building your application for the device? Please make sure you have not enabled it. Also, I have shared your query to the concern team and they are looking into it. We will update you very soon regarding this.

P.S As of now, we have tested App42 Unity SDK with Unity 5.01 and we are in the process of testing with latest version of Unity.

Regards,

Himanshu Sharma
answered Dec 17, 2015 by hs00105 (2,005 points)
selected Dec 17, 2015 by mostrolabs
Hi Himanshu, disabling code stripping solved the problem but my game package size has increased a little.
Doesn't your plugin work when code stripping is enabled?

Thanks
Hello Mostrolabs,

As of now stripping level is not supported, but we are in the process of adding the support. However timeline is not decided yet, will update you very soon regarding the timeline.

Let us know if you need any other help from our side.

regards,
Himanshu Sharma
Thanks for your help, I got it working now, I'll be waiting for and update that supports Stripping Level, by now I'll be using it as is.
Thanks
Disabling stripping worked.  Thanks.  I was worried I'd never get this working.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...