I'm seeing in the field several dozen ANRs happening inside Purchases.configure. I am calling configure during Application.onCreate(), which matches your examples.
For reference, I have 16 products defined for Google Play where this is failing and 13 products defined for Amazon. These are part of 8 offerings, most with 3 packages. I don't know if the quantity here is impacting the configure time, but it doesn't seem like much compared to other apps.
Here are a sampling of my ANRs. Each ANR exception is a bit different, likely due to how far configure got in reconstituting its data before the system killed it with the ANR hammer. The second one is especially concerning to me since it shows json parsing happening on the main thread, which implies I/O and that is generally a bad idea on the main thread.
at com.revenuecat.purchases.PurchasesFactory.createPurchases (PurchasesFactory.kt:166)
at com.revenuecat.purchases.PurchasesFactory.createPurchases$default (PurchasesFactory.kt:58)
at com.revenuecat.purchases.Purchases$Companion.configure (Purchases.kt:852)
at kotlinx.serialization.modules.SerializersModuleKt. (SerializersModule.kt:80)
at kotlinx.serialization.modules.SerializersModuleKt.getEmptySerializersModule (SerializersModule.kt)
at kotlinx.serialization.modules.SerializersModuleBuildersKt.EmptySerializersModule (SerializersModuleBuilders.kt:40)
at kotlinx.serialization.json.Json$Default. (Json.kt:71)
at kotlinx.serialization.json.Json$Default. (Json.kt)
at kotlinx.serialization.json.Json. (Json.kt)
at kotlinx.serialization.json.JsonKt.Json$default (Json.kt:197)
at com.revenuecat.purchases.common.OfferingParser. (OfferingParser.kt:21)
at com.revenuecat.purchases.OfferingParserFactory.createOfferingParser (OfferingParserFactory.kt:12)
at com.revenuecat.purchases.PurchasesFactory.createPurchases (PurchasesFactory.kt:218)
at com.revenuecat.purchases.PurchasesFactory.createPurchases$default (PurchasesFactory.kt:58)
at com.revenuecat.purchases.Purchases$Companion.configure (Purchases.kt:852)
at com.revenuecat.purchases.BillingFactory.createBilling (BillingFactory.kt:24)
at com.revenuecat.purchases.PurchasesFactory.createPurchases (PurchasesFactory.kt:132)
at com.revenuecat.purchases.PurchasesFactory.createPurchases$default (PurchasesFactory.kt:58)
at com.revenuecat.purchases.Purchases$Companion.configure (Purchases.kt:852)
at java.util.concurrent.ConcurrentHashMap. (ConcurrentHashMap.java:844)
at kotlinx.serialization.json.internal.CreateMapForCacheKt.createMapForCache (createMapForCache.kt:15)
at kotlinx.serialization.json.internal.DescriptorSchemaCache. (SchemaCache.kt:20)
at kotlinx.serialization.json.Json. (Json.kt:64)
at kotlinx.serialization.json.Json. (Json.kt)
at kotlinx.serialization.json.Json$Default. (Json.kt:71)
at kotlinx.serialization.json.Json$Default. (Json.kt)
at kotlinx.serialization.json.Json. (Json.kt)
at kotlinx.serialization.json.JsonKt.Json$default (Json.kt:197)
at com.revenuecat.purchases.common.OfferingParser. (OfferingParser.kt:21)
at com.revenuecat.purchases.OfferingParserFactory.createOfferingParser (OfferingParserFactory.kt:12)
at com.revenuecat.purchases.PurchasesFactory.createPurchases (PurchasesFactory.kt:218)
at com.revenuecat.purchases.PurchasesFactory.createPurchases$default (PurchasesFactory.kt:58)
at com.revenuecat.purchases.Purchases$Companion.configure (Purchases.kt:852)
at kotlin.Pair. (Tuples.kt:26)
at kotlin.TuplesKt.to (Tuples.kt:43)
at com.revenuecat.purchases.common.BackendHelper. (BackendHelper.kt:15)
at com.revenuecat.purchases.PurchasesFactory.createPurchases (PurchasesFactory.kt:120)
at com.revenuecat.purchases.PurchasesFactory.createPurchases$default (PurchasesFactory.kt:58)
at com.revenuecat.purchases.Purchases$Companion.configure (Purchases.kt:852)
at kotlin.jvm.internal.Intrinsics.checkNotNullParameter (Intrinsics.java)
at com.revenuecat.purchases.common.networking.ETagManager. (ETagManager.kt)
at com.revenuecat.purchases.common.networking.ETagManager. (ETagManager.kt:51)
at com.revenuecat.purchases.PurchasesFactory.createPurchases (PurchasesFactory.kt:86)
at com.revenuecat.purchases.PurchasesFactory.createPurchases$default (PurchasesFactory.kt:58)
at com.revenuecat.purchases.Purchases$Companion.configure (Purchases.kt:852)
Now I could call configure in the background, but that could introduce race conditions around Purchases being configured. So I would like to know what the design intent is here and if there is a bug in doing too much I/O. Also depending upon the answer, your examples may need to be changed.
I'm seeing in the field several dozen ANRs happening inside Purchases.configure. I am calling configure during Application.onCreate(), which matches your examples.
For reference, I have 16 products defined for Google Play where this is failing and 13 products defined for Amazon. These are part of 8 offerings, most with 3 packages. I don't know if the quantity here is impacting the configure time, but it doesn't seem like much compared to other apps.
Here are a sampling of my ANRs. Each ANR exception is a bit different, likely due to how far configure got in reconstituting its data before the system killed it with the ANR hammer. The second one is especially concerning to me since it shows json parsing happening on the main thread, which implies I/O and that is generally a bad idea on the main thread.
Now I could call configure in the background, but that could introduce race conditions around Purchases being configured. So I would like to know what the design intent is here and if there is a bug in doing too much I/O. Also depending upon the answer, your examples may need to be changed.