在gradle中添加abmob依赖项后,android应用程序崩溃

时间:2020-04-15 09:49:16

标签: java android crash admob build.gradle

apply plugin: 'com.android.application'

android {

    compileSdkVersion 29

    buildToolsVersion "28.0.3"

    defaultConfig {

        applicationId "arvindo.bassboster"

        minSdkVersion 16

        targetSdkVersion 29
    }

    dependencies {

        //noinspection GradleCompatible

        implementation 'com.android.support:appcompat-v7:23.1.1'

// ... other dependencies
    }

    buildTypes {

        release {

            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {

   exclude group: 'com.android.support', module: 'support-annotations'

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

    })

    //noinspection GradleCompatible

    implementation 'androidx.appcompat:appcompat:1.1.0'


    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    testImplementation 'junit:junit:4.12'

    //noinspection GradleCompatible

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

应用程序在删除Admob依赖项后运行良好,

日志

2020-04-15 15:09:05.847 560-560/? I/hwservicemanager: getTransport: Cannot find entry vendor.qti.hardware.iop@2.0::IIop/default in either framework or device manifest.
2020-04-15 15:09:05.851 1051-31588/? D/AudioPolicyService: UidPolicy::onUidStateChanged() UID=99369 procState=20
2020-04-15 15:09:05.853 20651-20753/? I/DCS-BackgroundAppData: sendAppBgEvent: has no pkgName=com.sonyliv
2020-04-15 15:09:05.885 560-560/? I/hwservicemanager: getTransport: Cannot find entry vendor.qti.hardware.iop@2.0::IIop/default in either framework or device manifest.
2020-04-15 15:09:05.887 4347-4347/? I/Zygote: Process 29064 exited cleanly (0)
2020-04-15 15:09:05.887 560-560/? E/SELinux: avc:  denied  { find } for interface=vendor.qti.hardware.servicetracker::IServicetracker sid=u:r:system_server:s0 pid=1808 scontext=u:r:system_server:s0 tcontext=u:object_r:default_android_hwservice:s0 tclass=hwservice_manager permissive=0
2020-04-15 15:09:05.890 20651-20753/? I/DCS-BackgroundAppData: sendAppBgEvent: has no pkgName=com.sonyliv
2020-04-15 15:09:05.928 1808-2130/? D/KernelCpuUidUserSysTimeReader: Removing uids 99006-99006
2020-04-15 15:09:05.929 1808-2130/? D/OppoBatteryStatsImpl: Got readings for an isolated uid with no mapping: 99006
2020-04-15 15:09:05.988 4508-4508/? D/OppoNecManager: notifyOrigSignalStrengthChanged slotId:0
2020-04-15 15:09:05.989 1808-6779/? D/OppoNecService: reportNecEvent.slotId:0,eventId:8000
2020-04-15 15:09:05.992 4497-4497/? D/OppoNecEventListener: handleNecEventReport:8000
2020-04-15 15:09:07.772 4508-4508/? D/OppoNecManager: notifyOrigSignalStrengthChanged slotId:0
2020-04-15 15:09:07.773 1808-6779/? D/OppoNecService: reportNecEvent.slotId:0,eventId:8000
2020-04-15 15:09:07.776 4497-4497/? D/OppoNecEventListener: handleNecEventReport:8000
2020-04-15 15:09:09.017 30968-31015/? I/WorkerManager: dispose()
2020-04-15 15:09:10.194 1808-3757/? D/WifiClientModeImpl: Adjust rssi from -21 to -35
2020-04-15 15:09:10.314 1808-1808/? D/OppoPowerMonitor: Receive broadcast android.intent.action.BATTERY_CHANGED
2020-04-15 15:09:10.318 20498-20498/? D/KeyguardUpdateMonitor: received broadcast android.intent.action.BATTERY_CHANGED
2020-04-15 15:09:10.628 1808-2015/? W/Watchdog: !@WatchDog_27033
2020-04-15 15:09:15.196 1808-3757/? D/WifiClientModeImpl: Adjust rssi from -18 to -35
2020-04-15 15:09:15.498 1808-1808/? D/OppoPowerMonitor: Receive broadcast android.intent.action.BATTERY_CHANGED
2020-04-15 15:09:15.503 20498-20498/? D/KeyguardUpdateMonitor: received broadcast android.intent.action.BATTERY_CHANGED
2020-04-15 15:09:15.639 27558-27559/? E/rutils: releaseProcess gCount = 3

1 个答案:

答案 0 :(得分:0)

您不能将依赖项放在androidTestImplementation块中。这是没有意义的。请执行以下操作:

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
        // DONT PUT IT HERE!
    })

    implementation 'com.google.android.gms:play-services-ads:19.0.1' // <-- put it here

    //noinspection GradleCompatible

    implementation 'androidx.appcompat:appcompat:1.1.0'


    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    testImplementation 'junit:junit:4.12'

    //noinspection GradleCompatible

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