mattak's blog

気の向くままに書く

ゲームブートキャンプ13日目

今日やること

  • GooglePlayServicesつづき

Minimal を動かす

いろいろあってできたー

f:id:mattaclj:20140318194848p:plain

はまりポイント:

  • GooglePlay上にAPKをあげている必要はない (ただし、テスト端末として登録しておく必要あり)
  • Androidアプリであれば、ApplicationIdさえ設定すればOK
  • BuildのExportしてgradleで手動ビルドするとうまくいかない。。

下記の感じのエラーがでる

I/Unity   ( 1674): AndroidJavaException: java.lang.ClassNotFoundException: com.google.example.games.basegameutils.GameHelper
I/Unity   ( 1674):   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0
I/Unity   ( 1674):   at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0
I/Unity   ( 1674):   at UnityEngine.AndroidJavaObject._CallStatic[AndroidJavaObject] (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0
I/Unity   ( 1674):   at UnityEngine.AndroidJavaObject.CallStatic[AndroidJavaObject] (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0
I/Unity   ( 1674):   at UnityEngine.AndroidJavaObject.FindClass (System.String name) [0x00000] in <filename unknown>:0
I/Unity   ( 1674):   at UnityEngine.AndroidJavaObject._AndroidJavaObject (System.String className, System.Object[] args) [0x00000] in <filename unknown>:0
I/Unity   ( 1674):   at UnityEngine.AndroidJavaObject..ctor (System.String className, System.Object[] args) [0x00000] in <filename unknown>:0
I/Unity   ( 1674):   at GooglePlayGames.A
I/Unity   ( 1674): NullReferenceException: Object reference not set to an instance of an object
I/Unity   ( 1674):   at GooglePlayGames.Android.AndroidClient+<Authenticate>c__AnonStorey0.<>m__1 () [0x00000] in <filename unknown>:0
I/Unity   ( 1674):   at UnityEngine.AndroidJavaRunnableProxy.run () [0x00000] in <filename unknown>:0
I/Unity   ( 1674):   at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
I/Unity   ( 1674): Rethrow as TargetInvocationException: UnityEngine.AndroidJavaRunnableProxy.run()
I/Unity   ( 1674):   at UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0
I/Unity   ( 1674):   at UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, UnityEngine.AndroidJavaObject[] javaArgs) [0x00000] in <filename unknown>:0
I/Unity   ( 1674):   at UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, IntPtr jmethodName, IntPtr jargs) [0x00000] in <filename unknown>:0

おそらく、unity のjniレイヤーからcom.google.example.games.basegameutils.GameHelperクラスをよびだしているんだけど、このクラスが見つかってない。

アプリにくみこむ

サンプルも動いたことだしアプリに組み込む