I was checking the new `apollo-v4 (4.0.1)` as per ...
# apollo-kotlin
s
I was checking the new
apollo-v4 (4.0.1)
as per the documentation but encountered that I wasn't able to call
.normalizedCache()
from the
ApolloClient.Builder()
method. Have anyone faced the same issue so far? Reference:
Copy code
ApolloClient.Builder()
            .serverUrl(SERVER_URL)

            // Add headers for authentication
            .addHttpHeader(
                HEADER_AUTHORIZATION,
                "$HEADER_AUTHORIZATION_BEARER ${BuildConfig.GITHUB_OAUTH_KEY}"
            )
            .normalizedCache(memoryFirstThenSqlCacheFactory)
            .build()
g
I had a different issue with regards to normalized cache library. FetchPolicy was missing. If it is an extension function probably the library is missing. I had to explicitly add normalized-cache library to dependencies
s
FetchPolicy
is also missing from my end as well. Do you get
normalizedCache(...)
with
apollo-v4.0.1
?
g
If you include
normalized-cache
dependency yes. They are all in the same Extensions file
Try adding
Copy code
implementation("com.apollographql.apollo:apollo-normalized-cache:4.0.1")
s
I have following added to my libs.toml:
Copy code
apollo-runtime = { module = "com.apollographql.apollo:apollo-runtime", version.ref = "apollo" }
apollo-normalized-cache-sqlite = { module = "com.apollographql.apollo:apollo-normalized-cache-sqlite", version.ref = "apollo" }
apollo-normalized-cache = { module = "com.apollographql.apollo:apollo-normalized-cache", version.ref = "apollo" }
As a matter of fact I can use the same using version 4.0.0. 😅