LoginSignup
2
3

More than 5 years have passed since last update.

Unity で Android 向けに Google Play Services のライブラリを追加する。

Last updated at Posted at 2016-05-10

Unity 5のプロジェクトに Growthbeat SDK for Unity を追加してAndroidで実行したら

Uncaught Exception: java.lang.NoClassDefFoundError; com.google.android.gms.iid.InstanceID

という実行時エラーが出たので google-play-services.jar を Assets/Plugins/Android 以下に配置したら今度は

warning: Ignoring InnerClasses attribute for an anonymous inner class (org.shaded.apache.commons.logging.LogFactory$3) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is not an inner class.

ということをビルド時に言われてしまったので、Google Play Servicesへの依存を追加する (Unity) — Repro ドキュメント を参考に

~/Library/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-gcm/x.x.x/play-services-gcm-x.x.x.aar ファイルを Assets/Plugins/Android/libs ディレクトリにコピーしてください

というわけで、 *.jar ではなく *.aar 形式のライブラリとして追加したらOKでした。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3