--> -->

skimemo


skimemo - 日記/2013-08-09

_ com.google.android.gms.appstate.APP_IDの指定方法

googleのapp_stateを使おうとしてたんですが、どうも起動時にfatalなexceptionが出てしまいます。

java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.

 Manifestの記述はこんな感じ。

Everything is expanded.Everything is shortened.
  1
  2
  3
 
 
 
<meta-data
android:name="com.google.android.gms.appstate.APP_ID"
android:value="4240*******2-qf21r4bncindpiv....." />

(一部伏せ字)

 LogCatの出力をfilterせずによく見てみると、こんなエラーが出ていました。

Application ID (4240*******2-qf21r4bncindpiv.....) must be a numeric value. Please verify that your manifest refers to the correct project ID.

 どうやらapp_idは数字部分のみで良いようです。そこで以下のようにしてみると、

Everything is expanded.Everything is shortened.
  1
  2
  3
 
 
 
<meta-data
android:name="com.google.android.gms.appstate.APP_ID"
android:value="4240*******2" />

 またエラー。

com.google.android.gms.appstate.APP_ID expected String but value was a java.lang.Integer. The default value <null> was returned.

 今度はAPIから、文字じゃなきゃダメと怒られます。
 どないせいっちゅうねん。
 なんて言ってみても始まらないので、どうすればいいかというと、

Everything is expanded.Everything is shortened.
  1
  2
  3
 
 
 
<meta-data
android:name="com.google.android.gms.appstate.APP_ID"
android:value="@string/app_id" />

 としてstring指定にし、strings.xmlに以下のように指定しておきます。

Everything is expanded.Everything is shortened.
  1
 
<string name="app_id">4240*******2</string>

 こんな事のためにかなり無駄な時間を使いました・・・。

Category: [android] - 17:38:01



 
Last-modified: 2013-08-09 (金) 17:38:02 (3905d)