Android项目集成Appodeal原生广告遇Manifest配置错误求助
Hey, I’ve helped a handful of developers work through this exact issue when integrating Appodeal ads. The red errors you’re seeing boil down to missing dependencies or incomplete Activity configuration. Let’s fix this step by step:
1. Add the Google Play Services Ads Dependency
First, make sure you’ve included the required Ads library in your module-level build.gradle (not the project-level one). This is the most common root cause:
dependencies { // Replace with the latest version (check Google's official docs for updates) implementation 'com.google.android.gms:play-services-ads:22.6.0' }
After adding this, click "Sync Now" in Android Studio to let Gradle pull in the dependency.
2. Fix the Incomplete AdActivity Declaration
The AdActivity line you posted is missing its closing tag and required configuration attributes. Replace it with this full, correct declaration:
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:exported="false" />
The configChanges attribute is mandatory for AdActivity to handle screen rotations and input changes properly. The exported flag is required for Android 12+ since this activity doesn’t need to be accessible to external apps.
3. Resolve the google_play_services_version Error
If you’re still getting an error for @integer/google_play_services_version, try these fixes:
- Preferred method: Wait for Gradle to finish syncing the Ads dependency—this integer resource is automatically generated when the library is properly imported.
- Alternative method: Replace the reference with the specific version code for your Play Services library. For example:
(Note: This value corresponds to recent Play Services versions, but using the<meta-data android:name="com.google.android.gms.version" android:value="2131099648" />@integerreference is better for future compatibility.)
4. Double-Check Appodeal Configuration
Since you’re integrating Appodeal, make sure its core dependency is also in your build.gradle:
implementation 'com.appodeal.ads:sdk:3.1.1' // Use the latest Appodeal SDK version
Also, confirm you’ve added Appodeal’s required initialization code in your Application class’s onCreate() method, and any other Appodeal-specific Manifest entries are present.
Once you’ve made these changes, clean your project (Build > Clean Project) and rebuild. That should clear up all the red errors in your AndroidManifest.xml.
内容的提问来源于stack exchange,提问作者Arman Hossain

