package com.revenuecat.purchases.galaxy;

import android.content.Context;
import com.revenuecat.purchases.PurchasesStateProvider;
import com.revenuecat.purchases.common.BillingAbstract;
import com.revenuecat.purchases.common.caching.DeviceCache;
import kotlin.jvm.internal.o;

/* JADX INFO: loaded from: classes3.dex */
public final class GalaxyBillingWrapperFactory {
    public static final GalaxyBillingWrapperFactory INSTANCE = new GalaxyBillingWrapperFactory();

    private GalaxyBillingWrapperFactory() {
    }

    public final BillingAbstract createGalaxyBillingWrapper(PurchasesStateProvider stateProvider, Context context, GalaxyBillingMode billingMode, DeviceCache deviceCache) {
        o.h(stateProvider, "stateProvider");
        o.h(context, "context");
        o.h(billingMode, "billingMode");
        o.h(deviceCache, "deviceCache");
        try {
            Object objNewInstance = Class.forName("com.revenuecat.purchases.galaxy.GalaxyBillingWrapper").getDeclaredConstructor(PurchasesStateProvider.class, Context.class, GalaxyBillingMode.class, DeviceCache.class).newInstance(stateProvider, context, billingMode, deviceCache);
            o.f(objNewInstance, "null cannot be cast to non-null type com.revenuecat.purchases.common.BillingAbstract");
            return (BillingAbstract) objNewInstance;
        } catch (ClassNotFoundException e6) {
            NoClassDefFoundError noClassDefFoundError = new NoClassDefFoundError(e6.getMessage());
            noClassDefFoundError.initCause(e6);
            throw noClassDefFoundError;
        } catch (NoSuchMethodException e7) {
            throw new IllegalStateException("Failed to find GalaxyBillingWrapper constructor. Please ensure that you've declared a dependency on the purchases-galaxy module.", e7);
        } catch (ReflectiveOperationException e8) {
            throw new IllegalStateException("Failed to create GalaxyBillingWrapper", e8);
        }
    }
}
