Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
509 views
in Technique[技术] by (71.8m points)

android - Why I am getting 'ApolloParseException' after upgrading from 1.0.0-alpha to 1.0.0?

I am currently upgraded an old project's Apollo version from 1.0.0-alpha to 1.0.0 .

After upgrading I am getting this Exception

com.apollographql.apollo.exception.ApolloParseException: Failed to parse http response
    at com.apollographql.apollo.internal.interceptor.ApolloParseInterceptor.parse(ApolloParseInterceptor.java:101)
    at com.apollographql.apollo.internal.interceptor.ApolloParseInterceptor$1.onResponse(ApolloParseInterceptor.java:53)
    at com.apollographql.apollo.internal.interceptor.ApolloServerInterceptor$1$1.onResponse(ApolloServerInterceptor.java:106)
    at okhttp3.RealCall$AsyncCall.execute(RealCall.java:203)
    at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:764)
 Caused by: java.io.EOFException: End of input
    at com.apollographql.apollo.internal.json.BufferedSourceJsonReader.nextNonWhitespace(BufferedSourceJsonReader.java:946)
    at com.apollographql.apollo.internal.json.BufferedSourceJsonReader.doPeek(BufferedSourceJsonReader.java:332)
    at com.apollographql.apollo.internal.json.BufferedSourceJsonReader.beginObject(BufferedSourceJsonReader.java:169)
    at com.apollographql.apollo.response.OperationResponseParser.parse(OperationResponseParser.java:82)
    at com.apollographql.apollo.internal.interceptor.ApolloParseInterceptor.parse(ApolloParseInterceptor.java:87)
    at com.apollographql.apollo.internal.interceptor.ApolloParseInterceptor$1.onResponse(ApolloParseInterceptor.java:53) 
    at com.apollographql.apollo.internal.interceptor.ApolloServerInterceptor$1$1.onResponse(ApolloServerInterceptor.java:106) 
    at okhttp3.RealCall$AsyncCall.execute(RealCall.java:203) 
    at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
    at java.lang.Thread.run(Thread.java:764) 

But everything was fine till I upgraded . I upgraded to 1.0 stable from alpha because I upgraded Gradle due to Firebase Crashlytics migration .

Apollo alpha threw build errors in new Gradle . So I upgraded to 1.0 and build success

But after opening the app, I got this exception

The mystery here is =>

The okHTTP logging interceptor printing the response JSON and it valid and correct too.

But Apollo can't parse it

Why apollo can't parse the JSON when it received correctly ?

Limitations And one Sad thing is , I can't upgrade to latest apollo versions due to using lot of old packages, since old packages incompatible with new Gradle 6+ and apollo latest version needs new Gradle .

Please help me

Info :

  • Apollo version : 1.0 (1.0 alpha before)
  • Gradle build tools : 3.6.4
  • Gradle : 5.6.4
  • Kotlin : 1.3.72

Sample Query

#Get Profile Details
query GetProfile {
 userAccount {
 result {
 userId
 profileId
 firstName
 lastName
 displayName
 gender
 dateOfBirth
 iosDOB
 email
 userBanStatus
 phoneNumber
 preferredLanguage
 preferredLanguageName
 preferredCurrency
 location
 info
 createdAt
 picture
 country
 loginUserType
 isAddedList
 verification {
 id
 isEmailConfirmed
 isFacebookConnected
 isGoogleConnected
 isIdVerification
 isPhoneVerified
 }
 userData {
 type
 }
 verificationCode
 countryCode
 loginUserType
 isAddedList
 }
 status
 errorMessage
 }
 }

Response (from okhttp logger) :

{
"data": {
"userAccount": {
"__typename": "WholeAccount",
"result": {
"__typename": "UserAccount",
"userId": "2bced470-49b7-11eb-a6aa-89804552bd8c",
"profileId": 28,
"firstName": "Ragesh",
"lastName": "Antony",
"displayName": "Ragesh Antony",
"gender": null,
"dateOfBirth": "6-1993-3",
"iosDOB": "6-3-1993",
"email": "[email protected]",
"userBanStatus": null,
"phoneNumber": null,
"preferredLanguage": null,
"preferredLanguageName": null,
"preferredCurrency": null,
"location": null,
"info": null,
"createdAt": "1609233662000",
"picture": "52cd186f3f176cd981a4085887cd019d.jpeg",
"country": null,
"loginUserType": "Guest",
"isAddedList": false,
"verification": {
"__typename": "UserVerifiedInfo",
"id": 28,
"isEmailConfirmed": true,
"isFacebookConnected": false,
"isGoogleConnected": false,
"isIdVerification": false,
"isPhoneVerified": false
},
"userData": {
"__typename": "UserType",
"type": "email"
},
"verificationCode": null,
"countryCode": null
},
"status": 200,
"errorMessage": null
}
}
}

====

Apollo Config Module :

https://gist.github.com/RageshAntony/86686ebb9557698d8569acec6fc04b42

Please help me to resolve this issue


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...