So I just updated to Unity 4.2 and I now get this error in my console when running my game:
Exception: JNI: Init’d AndroidJavaClass with null ptr!
UnityEngine.AndroidJavaClass…ctor (IntPtr jclass) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Runtime/Export/AndroidJavaImpl.cs:533)
Now I ignored this error at first because I assumed it was because I’m not on an Android device. But because of this error my events don’t work so I can’t truely test my game without exporting it.
Let me note that this error did NOT happen on Unity 4.1, I did no change in my code, just updated Unity.
This is the code that is cuasing the error:
#if UNITY_ANDROID AdClass = new AndroidJavaClass("com.package.name.Ads"); #endif
AdClass is declared as followed
public static AndroidJavaClass AdClass;
When I build my APK and put it on my android device there are no problems. So this is just happening in the editor. Like stated before I can’t ignore this error because it stops all my events so my game doesn’t run properly.
Anyone have any suggestions on how I can get rid of this error?