2

私は多くのことを行うライブラリを書いています。

状況: 私の Android プロジェクト AAA では、ライブラリ XXX をインクルードし、(ライブラリ XXX にある) 抽象クラス A から派生させます。

ライブラリ XXX で派生クラスを呼び出そうとすると、GSON がクラスを見つけられません (デバッガーで正しいクラスを確認できます - 以前にファクトリに提供されていました)。

Gson はInvocationTargetException解決プロセス中に停止します。ライブラリXXXの一部である場合、まったく同じクラスが機能します

JSON:

    {
      "subtext":"super subtext!!!",
      "myText":"hello 1",
      "id":"ff8081813cf34f79013cf34fba750001",
      "myAAA":false, 
      "version":0
    }      

コード:

  // code to invoke (in library XXX)
  public static A fromJson(String gsonString,
        Class clazz) {
    A myAbstractClass = null; // A1 is a subclass of A
    try {
        Gson gson = new Gson();
        myAbstractClass = gson.fromJson(gsonString, clazz);
    } catch (Exception e) {

    }
    return myAbstractClass;

}

どうすればこれを解決できますか?

編集:スタックトレース

02-19 17:58:24.442: E/AndroidRuntime(4463): FATAL EXCEPTION: main
02-19 17:58:24.442: E/AndroidRuntime(4463): java.lang.StackOverflowError
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:371)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:380)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:375)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:355)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:117)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
02-19 17:58:24.442: E/AndroidRuntime(4463):     at com.google.gson.Gson.getAdapter(Gson.java:353)
4

0 に答える 0