Android错误:com.google.android.gms.persistent E / NetworkScheduler:指定的组件无效

时间:2018-11-14 18:37:46

标签: android admob

当我使用在Android 5.1中运行的admob时,我的项目android有错误 应用程序显示日志错误:

11-15 01:16:13.645 1143-1143/? E/EGL_emulation: tid 1143: eglCreateSyncKHR(1865): error 0x3004 (EGL_BAD_ATTRIBUTE)
11-15 01:16:13.776 2356-21878/com.google.android.gms.persistent E/NetworkScheduler: Invalid component specified.

这是我的build.gradle文件的内容:

compileSdkVersion 26
    buildToolsVersion '26.0.0'
    defaultConfig {
        applicationId "com.exam"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 2
        versionName "2.00"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"


dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.1.0'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:design:26.1.0'
    
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.squareup.okhttp3:okhttp:3.5.0'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.android.support:percent:26.1.0'
    compile 'com.squareup.retrofit2:retrofit:2.2.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.github.rahatarmanahmed:circularprogressview:2.5.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.afollestad.material-dialogs:commons:0.9.5.0'
    compile 'com.afollestad.material-dialogs:core:0.9.5.0'
    compile 'org.jsoup:jsoup:1.10.2'
    compile 'com.google.firebase:firebase-ads:17.1.0'
    compile 'com.github.ksoichiro:android-observablescrollview:1.6.0'
    compile 'agency.tango.android:material-intro-screen:0.0.5'
    compile 'com.google.firebase:firebase-core:16.0.4'
    compile 'cn.pedant.sweetalert:library:1.3'
    compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
    compile 'com.github.lzyzsd:circleprogress:1.2.1'
    compile 'com.github.hotchemi:android-rate:1.0.1'
}

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

我尝试了很多解决方案,但是没有用 感谢任何可以解决它。请帮帮我!

1 个答案:

答案 0 :(得分:0)

在build.gradle行下方添加

implementation 'com.google.android.gms:play-services-ads:17.0.0'

如果您使用的是17+ AdMob SDK,则需要在AndroidManifest.xml文件中指定应用ID。您可以在Admob应用设置中找到您的应用ID

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="@string/app_id"/>

添加上述代码后,请尝试手动卸载该应用程序,然后重新安装而不进行任何更改。还要用实现替换您的编译。