xtralifecloud / unity-sdk

XtraLife C# Unity plugin
MIT License
12 stars 6 forks source link

JNI Init exception inapp purchase package #9

Closed TobyKaos closed 7 years ago

TobyKaos commented 7 years ago

Lorsque l'on lance le sample inapp purchase du Unity SDK 1.1.1 on obtient une erreur dans la console de l'éditeur Unity:

Exception: JNI: Init'd AndroidJavaClass with null ptr! UnityEngine.AndroidJavaClass..ctor (IntPtr jclass) (at C:/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:556) UnityEngine.AndroidJavaObject.get_JavaLangClass () (at C:/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:534) UnityEngine.AndroidJavaObject.FindClass (System.String name) (at C:/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:525) UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) (at C:/buildslave/unity/build/Runtime/Export/AndroidJavaImpl.cs:545) UnityEngine.AndroidJavaClass..ctor (System.String className) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/AndroidJavaBindings.gen.cs:94) CotcSdk.InappPurchase.GooglePlayStoreImpl..ctor (System.String gameObjectName) (at Assets/Cotc.InAppPurchase/Scripts/GooglePlayStoreImpl.cs:18) CotcSdk.InappPurchase.CotcInappPurchaseGameObject.Start () (at Assets/Cotc.InAppPurchase/Scripts/CotcInappPurchaseGameObject.cs:13)

Unity 5.4.1f1 Plateforme Android dans editeur Unity

Il faut rajouter un test preproc #if UNITY_EDITOR avant les test UNITY_ANDROID dans le fichier CotcInappPurchaseGameObject pour ne pas essayer de créer le GooglePlayStoreImpl dans l'éditeur Unity

Sebastien-XL commented 7 years ago

Le test est rajouté. :)