0

我正在尝试通过 AdMob 中介使用 MoPub。我已按照https://developers.google.com/admob/android/mediation/mopub上的所有说明进行操作。

目前我通过admob中介使用facebook、applovin、inmobi,它们都运行良好。我多次集成 MoPub,但它总是说找不到清单。问题出在第 3 步https://developers.google.com/admob/android/mediation/mopub#step_3_import_the_mopub_sdk_and_adapter

注意:我使用的是 androidX。

测试时我看到了这一点。我使用了 admob 中介测试套件,发现是这样的。 它说没有找到清单

这是我的应用级build.gradle

 apply plugin: 'com.android.application'
 apply plugin: 'com.google.gms.google-services'


  android {

compileSdkVersion 30
buildToolsVersion '30.0.1'
defaultConfig {
    applicationId 'com.theaccidentalmedico.sociology'
    minSdkVersion 21
    targetSdkVersion 30
    versionCode 1
    versionName "1.0.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
    debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    release {
        shrinkResources true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

    }
}
lintOptions {
    disable 'MissingTranslation'
}
productFlavors {
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}
  repositories {
        google()
        jcenter()
         maven {
        url "https://s3.amazonaws.com/moat-sdk-builds"}
        }
   dependencies {
  implementation fileTree(include: ['*.jar'], dir: 'libs')

androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.google.firebase:firebase-analytics:17.4.4'
implementation 'com.google.android.gms:play-services-ads:19.2.0'
implementation 'com.google.ads.mediation:facebook:5.9.0.0'
implementation 'com.google.ads.mediation:mopub:5.13.1.0'
implementation 'com.codemybrainsout.rating:ratingdialog:1.0.8'
implementation 'com.google.ads.mediation:applovin:9.13.0.0'
implementation 'com.google.android.ads:mediation-test-suite:1.3.0'

implementation 'androidx.appcompat:appcompat:1.1.0'

implementation 'com.google.android.material:material:1.1.0'

testImplementation 'junit:junit:4.13'
   }

这是我的项目级 build.gradle。

buildscript {
repositories {
    google()
    jcenter()

 }
dependencies {
    classpath 'com.android.tools.build:gradle:3.6.4'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:4.3.3'
}
      }

      allprojects {
repositories {
    google()
    jcenter()
   
   }
     }

 task clean(type: Delete) {
delete rootProject.buildDir
    }

我正在使用AndroidX。这是我的gradle.properties文件

 # Project-wide Gradle settings.

 # IDE (e.g. Android Studio) users:
 # Gradle settings configured through the IDE *will override*
 # any settings specified in this file.

 # For more details on how to configure your build environment visit
 # http://www.gradle.org/docs/current/userguide/build_environment.html

 # Specifies the JVM arguments used for the daemon process.
 # The setting is particularly useful for tweaking memory settings.
 android.enableJetifier=true
 android.useAndroidX=true
 org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

在 admob 实施指南中,没有给出编辑 androidmanifest.xml 文件的说明。这是我的 androidmanifest.xml 文件。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.theaccidentalmedico.sociology">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

 <application
    android:allowBackup="true"
    android:networkSecurityConfig="@xml/network_security_config"
    android:icon="@mipmap/ic_launcher_foreground"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppThemeDefault"
    tools:targetApi="n">
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-8803330956819211~8267554096"/>
    <activity
        android:name="com.theaccidentalmedico.sociology.MainTabActivity"
        android:configChanges="orientation|keyboardHidden|navigation|screenSize"
        android:windowSoftInputMode="adjustPan|adjustResize"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.theaccidentalmedico.sociology.MainActivity"
        android:configChanges="orientation|keyboardHidden|navigation|screenSize" />
    <activity
        android:name="com.theaccidentalmedico.sociology.MeaningActivity"
        android:label="@string/title_meaning_activity" />
    <activity android:name="com.theaccidentalmedico.sociology.FavoriteActivity" />
    <activity android:name="com.theaccidentalmedico.sociology.SettingActivity" />
    <activity android:name="com.theaccidentalmedico.sociology.HistoryActivity"/>
</application>

</manifest>
4

2 回答 2

1

解决了

Mopub 的这个问题是因为中介测试套件 1.3.0。

解决方案:

转到您的应用程序级 build.gradle 并将中介测试套件版本更改为 1.4.0。

这样就解决了问题。

https://groups.google.com/g/google-admob-ads-sdk/c/NGMX-2P-sAM/m/v32f4uEhAAAJ

于 2020-08-24T05:59:11.683 回答
0

添加到 AndroidManifest.xml

<activity android:name="com.mopub.mobileads.MoPubActivity"
          android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidActivity"
          android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.common.MoPubBrowser"
          android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
          android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.RewardedMraidActivity"
          android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.common.privacy.ConsentDialogActivity"
          android:configChanges="keyboardHidden|orientation|screenSize"/>
于 2020-08-19T15:39:32.950 回答