代码之家  ›  专栏  ›  技术社区  ›  metis

虽然proguard是非活动的,但在发布模式下不显示真实广告。有什么问题吗?

  •  5
  • metis  · 技术社区  · 6 年前

    但是,当我生成已签名的apk并通过apk install将apk安装到我的设备上时。。。命令使用Android演播室终端,真实广告不显示。我首先认为这个问题与proguard有关,但是它与proguard无关。因为我停用了proguard,而真正的广告还没有出现。有什么问题吗?

    构建.gradle(应用程序级别):

    apply plugin: 'com.android.application'
    apply plugin: 'com.bugsnag.android.gradle'
    
    android {
        compileSdkVersion 28
        buildToolsVersion '28.0.3'
        defaultConfig {
            applicationId "...."
            minSdkVersion 16
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
            debug {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:appcompat-v7:28.0.0'
        implementation 'com.android.support:design:28.0.0'
        implementation 'com.android.support:recyclerview-v7:28.0.0'
        implementation 'jp.wasabeef:recyclerview-animators:2.2.4'
        implementation 'com.android.support:cardview-v7:28.0.0'
        implementation 'com.nex3z:flow-layout:1.1.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        implementation 'com.google.android.gms:play-services-ads:17.1.1'
        implementation 'com.bugsnag:bugsnag-android:4.+'
    }
    

    构建.gradle(项目级)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.1'
            classpath 'com.bugsnag:bugsnag-android-gradle-plugin:3.+'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
            maven { url "https://maven.google.com" }
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Moisoni Ioan    6 年前

    检查您的 logcat ,如果你 W/Ads: Failed to load ad: 3 警告-这意味着广告请求成功,但由于广告库存不足,未返回广告,因此您的代码正常!你只要等几天,广告就会出现。

    我的应用程序也有类似的问题,我在上发布了beta版 Google Play 5 dec 19 dec 广告今天才开始出现!