Installation
📦 Install JavaScript Package
Install the React Native module using npm or yarn:
npm
npm install react-native-ocm-adnetwork-module
yarn
yarn add react-native-ocm-adnetwork-module
🍎 iOS Setup
Step 1: Install CocoaPods Dependencies
After installing the JavaScript package, install native dependencies:
cd ios && pod install
Step 2: Configure Info.plist
Add your Google Mobile Ads application ID to ios/YourApp/Info.plist:
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~3347511713</string>
Replace the test App ID (ca-app-pub-3940256099942544~3347511713) with your actual Google AdMob or GAM Application ID before deploying to production.
Step 3: Update Podfile (if needed)
Ensure your ios/Podfile has the minimum iOS version set:
platform :ios, '12.0'
🤖 Android Setup
Step 1: Verify SDK Versions
Ensure your android/build.gradle has the correct SDK versions:
buildscript {
ext {
minSdkVersion = 24
compileSdkVersion = 34
targetSdkVersion = 34
}
}
Step 2: Add Google Maven Repository
Verify that the Google Maven repository is available in your root build.gradle:
allprojects {
repositories {
google()
mavenCentral()
}
}
For React Native 0.71+, repositories might be in settings.gradle instead:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}
Step 3: Configure AndroidManifest.xml
Add your Google Mobile Ads application ID to android/app/src/main/AndroidManifest.xml inside the <application> tag:
<application>
<!-- Replace with your own App ID -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713" />
<!-- Your activities and other components -->
</application>
The Android bridge automatically bundles the native dependency com.orangeclickmedia.adnetwork:adnetwork-sdk:1.0.3, so no additional Gradle configuration is required.
✅ Verify Installation
After completing the setup, rebuild your app:
iOS
npx react-native run-ios
Android
npx react-native run-android
If the build succeeds without errors, the SDK is properly installed!
🔧 Troubleshooting
iOS Issues
CocoaPods installation fails:
cd ios
pod install --repo-update
Build errors:
- Clean build folder: Product → Clean Build Folder in Xcode
- Delete
Podsfolder andPodfile.lock, then runpod installagain
Android Issues
Gradle sync fails:
- Ensure
minSdkVersionis at least 24 - Verify Google Maven repository is configured
- Clean and rebuild:
cd android && ./gradlew clean
Duplicate class errors:
- Check for conflicting dependencies
- Use
./gradlew :app:dependenciesto inspect dependency tree
Next Steps
Continue to Getting Started to initialize the SDK and load your first ad.