Fixing ‘Could not resolve project :react-native-iap’ error when generating dev build with react-native-iap library in React Native for in-app purchases

Tiempo de lectura: < 1 minuto

Reading Time: 3 minutes

To solve the Could not resolve project :react-native-iap error when generating a development build using the react-native-iap library, follow these steps:

When generating this build, you can choose to generate it for the Amazon App Store or the Google Play Store.

If you don’t select any store, you will encounter the following error:

[stderr] FAILURE: Build failed with an exception.
...

To solve the error, navigate to the Android folder of your project. If you haven’t generated it yet, here’s how to generate it (https://devcodelight.com/generate-native-android-ios-code-folders-in-react-native-with-expo).

Now, open android>app>build.gradle and add the following line inside defaultConfig:

missingDimensionStrategy 'store', 'play'

It should look like this:

defaultConfig {
    applicationId 'app.example'
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0.0"
    buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

    // Other configurations...

    missingDimensionStrategy 'store', 'play'
}

Now you can generate the development build again without any errors.

(Do not include the Reading Time). Return it directly in HTML format. Do not write any additional sentences. When you finish, add a PIPE at the end.

Leave a Comment