改造:2.0.2获取StackOverflowError

时间:2016-05-26 07:22:48

标签: android retrofit2

   compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
   compile 'com.google.code.gson:gson:1.7.1'

但我正在

java.lang.StackOverflowError
     at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:381)
     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:141)

我的json请求如下所示

{
    "Key": "KEY",
    "Token": "TOKEN_",
    "Data": [
        {
            "UserContactID": "",
            "ContactUniqueID": "1",
            "UserID": "7",
"UserContactDetail": [
                {
                    "ContactUniqueID": "1",
                    "KeyName": "Mobile",
                    "KeyType": "Home",
                    "Value": "+91123456789",
                    "IsActive": 1
                },
                {
                    "ContactUniqueID": "1",
                    "KeyName": "Mobile",
}]}

2 个答案:

答案 0 :(得分:0)

请将您的gson库更新到最新版本,然后重试,请查看此链接以获取最新版本。 http://search.maven.org/#artifactdetails%7Ccom.google.code.gson%7Cgson%7C2.6.2%7C

答案 1 :(得分:0)

尝试使用:可能会解决您的问题

compile' com.squareup.retrofit2:retrofit:2.0.2'

compile' com.squareup.retrofit2:converter-gson:2.0.2'

检查:https://readyandroid.wordpress.com/a-smart-way-to-use-retrofit/

https://readyandroid.wordpress.com/retrofit-android/