广告请求成功,但由于缺少广告资源而没有退回任何广告。 handleAdFailedToLoad

时间:2018-12-29 23:46:16

标签: javascript android react-native admob

我使用react-native,并且希望在应用中添加广告。但是我会犯这个错误。我尝试了Everythig,但它们不起作用。我认为此错误与AdMob Android SDK有关。我观看了SDK视频,但有关Android Studio的视频。这是本机反应。测试Unid ID功能。但真正的错误会导致此错误。所以,如果有人有一个实例项目已经在真实单位ID上工作过,您可以给我发克隆文件吗?

这是Android / build.grandle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

Android / app / build.grandle

apply plugin: "com.android.application"

import com.android.build.OutputFile


project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.example"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    applicationVariants.all { variant ->
        variant.outputs.each { output ->
          
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-admob')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile 'com.facebook.fresco:fresco:1.5.0'
    compile 'com.facebook.fresco:animated-gif:1.5.0'
    
}

 
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

如果您需要任何js文件,ı可以发送。请我处理2周。

1 个答案:

答案 0 :(得分:0)

如果测试单元工作,则实际单元也应工作。如果您的AdMob帐户是新帐户,如果是新帐户,请尝试进入另一个网络并使用其他设备进行测试。这是许多人发现的一个问题,但实际上可能是您的新帐户可能没有广告。