请帮助解决问题。 Admob广告没有出现在实际设备上小米Redmi note pro Android 6.0.1 API23,而模拟器一切运行良好:( Genymotion三星Galaxy S3 4.2.2 API 17
代码
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
// Initialize the Mobile Ads SDK.
MobileAds.initialize(this, "ca-app-pub-7916609733931280/5123195450");
// Gets the ad view defined in layout/ad_fragment.xml with ad unit ID set in
// values/strings.xml.
mAdView = (AdView) findViewById(R.id.ad_view);
// Create an ad request. Check your logcat output for the hashed device ID to
// get test ads on a physical device. e.g.
// "Use AdRequest.Builder.addTestDevice("ABCDEF012345") to get test ads on this device."
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("5EF11ADFE493CEA1C5E839D32DCBCD50")
.addTestDevice("1A1575EFE0A87B66006CE7BA6C51A51D")
.build();
// Start loading the ad in the background.
mAdView.loadAd(adRequest);
}
XML
<com.google.android.gms.ads.AdView
android:id="@+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/banner_ad_unit_id" />
摇篮
dependencies {
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.firebase:firebase-ads:10.0.1'
compile 'com.google.android.gms:play-services-ads:10.0.1'
}
apply plugin: 'com.google.gms.google-services'
logcat的
12-20 14:39:34.935 30022-30022/? I/art: Late-enabling -Xcheck:jni
12-20 14:39:34.944 30022-30022/? D/TidaProvider: TidaProvider()
12-20 14:39:35.009 30022-30022/com.google.android.gms.example.bannerexample W/System: ClassLoader referenced unknown path: /data/app/com.google.android.gms.example.bannerexample-2/lib/arm64
12-20 14:39:35.014 30022-30022/com.google.android.gms.example.bannerexample I/InstantRun: Instant Run Runtime started. Android package is com.google.android.gms.example.bannerexample, real application class is null.
12-20 14:39:35.490 30022-30022/com.google.android.gms.example.bannerexample W/System: ClassLoader referenced unknown path: /data/app/com.google.android.gms.example.bannerexample-2/lib/arm64
12-20 14:39:35.509 30022-30022/com.google.android.gms.example.bannerexample D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
12-20 14:39:35.519 30022-30022/com.google.android.gms.example.bannerexample D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
12-20 14:39:35.566 30022-30022/com.google.android.gms.example.bannerexample I/FA: App measurement is starting up, version: 10084
12-20 14:39:35.566 30022-30022/com.google.android.gms.example.bannerexample I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
12-20 14:39:35.566 30022-30022/com.google.android.gms.example.bannerexample D/FA: Debug-level message logging enabled
12-20 14:39:35.566 30022-30022/com.google.android.gms.example.bannerexample D/FA: AppMeasurement singleton hash: 231730626
12-20 14:39:35.572 30022-30022/com.google.android.gms.example.bannerexample V/FA: Collection enabled
12-20 14:39:35.573 30022-30022/com.google.android.gms.example.bannerexample V/FA: App package, google app id: com.google.android.gms.example.bannerexample, 1:999999999999:android:0000000000000000
12-20 14:39:35.574 30022-30022/com.google.android.gms.example.bannerexample I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.google.android.gms.example.bannerexample
12-20 14:39:35.618 30022-30022/com.google.android.gms.example.bannerexample V/FA: Registered activity lifecycle callback
12-20 14:39:35.619 30022-30022/com.google.android.gms.example.bannerexample I/FirebaseInitProvider: FirebaseApp initialization successful
12-20 14:39:35.622 30022-30072/com.google.android.gms.example.bannerexample V/FA: Using measurement service
12-20 14:39:35.709 30022-30022/com.google.android.gms.example.bannerexample V/FA: onActivityCreated
12-20 14:39:35.742 30022-30022/com.google.android.gms.example.bannerexample V/BoostFramework: mAcquireFunc method = public int com.qualcomm.qti.Performance.perfLockAcquire(int,int[])
12-20 14:39:35.742 30022-30022/com.google.android.gms.example.bannerexample V/BoostFramework: mReleaseFunc method = public int com.qualcomm.qti.Performance.perfLockRelease()
12-20 14:39:35.742 30022-30022/com.google.android.gms.example.bannerexample V/BoostFramework: mAcquireTouchFunc method = public int com.qualcomm.qti.Performance.perfLockAcquireTouch(android.view.MotionEvent,android.util.DisplayMetrics,int,int[])
12-20 14:39:35.742 30022-30022/com.google.android.gms.example.bannerexample V/BoostFramework: mIOPStart method = public int com.qualcomm.qti.Performance.perfIOPrefetchStart(int,java.lang.String)
12-20 14:39:35.742 30022-30022/com.google.android.gms.example.bannerexample V/BoostFramework: mIOPStop method = public int com.qualcomm.qti.Performance.perfIOPrefetchStop()
12-20 14:39:35.744 30022-30022/com.google.android.gms.example.bannerexample V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@8b3a6e6
12-20 14:39:35.744 30022-30022/com.google.android.gms.example.bannerexample V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@d3c5427
12-20 14:39:35.753 30022-30022/com.google.android.gms.example.bannerexample W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
12-20 14:39:35.867 30022-30022/com.google.android.gms.example.bannerexample D/DynamitePackage: Instantiated singleton DynamitePackage.
12-20 14:39:35.867 30022-30022/com.google.android.gms.example.bannerexample D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraMobileAdsSettingManagerCreatorImpl
12-20 14:39:35.883 30022-30022/com.google.android.gms.example.bannerexample I/WebViewFactory: Loading com.google.android.webview version 54.0.2840.85 (code 284008550)
12-20 14:39:35.916 30022-30022/com.google.android.gms.example.bannerexample I/art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.TokenBindingManagerAdapter>
12-20 14:39:35.916 30022-30022/com.google.android.gms.example.bannerexample I/art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.TokenBindingManagerAdapter>
12-20 14:39:35.918 30022-30022/com.google.android.gms.example.bannerexample I/art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.ServiceWorkerControllerAdapter>
12-20 14:39:35.918 30022-30022/com.google.android.gms.example.bannerexample I/art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.ServiceWorkerControllerAdapter>
12-20 14:39:35.923 30022-30022/com.google.android.gms.example.bannerexample I/cr_LibraryLoader: Time to load native libraries: 1 ms (timestamps 2280-2281)
12-20 14:39:35.923 30022-30022/com.google.android.gms.example.bannerexample I/cr_LibraryLoader: Expected native library version number "54.0.2840.85", actual native library version number "54.0.2840.85"
12-20 14:39:35.928 30022-30022/com.google.android.gms.example.bannerexample I/cr_LibraryLoader: Expected native library version number "54.0.2840.85", actual native library version number "54.0.2840.85"
12-20 14:39:35.929 30022-30022/com.google.android.gms.example.bannerexample I/chromium: [INFO:library_loader_hooks.cc(151)] Chromium logging enabled: level = 0, default verbosity = 0
12-20 14:39:35.936 30022-30022/com.google.android.gms.example.bannerexample I/cr_BrowserStartup: Initializing chromium process, singleProcess=true
12-20 14:39:35.949 30022-30022/com.google.android.gms.example.bannerexample I/Adreno: QUALCOMM build : a7823f5, I59a6815413
Build Date : 09/23/16
OpenGL ES Shader Compiler Version: XE031.07.00.00
Local Branch : mybranch22028469
Remote Branch : quic/LA.BR.1.3.3_rb2.26
Remote Branch : NONE
Reconstruct Branch : NOTHING
12-20 14:39:36.008 30022-30022/com.google.android.gms.example.bannerexample D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
12-20 14:39:36.020 30022-30096/com.google.android.gms.example.bannerexample I/DynamiteModule: Considering local module com.google.android.gms.piccard.dynamite:0 and remote module com.google.android.gms.piccard.dynamite:9
12-20 14:39:36.020 30022-30096/com.google.android.gms.example.bannerexample I/DynamiteModule: Selected remote version of com.google.android.gms.piccard.dynamite, version >= 9
12-20 14:39:36.022 30022-30022/com.google.android.gms.example.bannerexample I/Ads: Starting ad request.
12-20 14:39:36.064 30022-30096/com.google.android.gms.example.bannerexample W/AudioCapabilities: Unsupported mime audio/evrc
12-20 14:39:36.065 30022-30096/com.google.android.gms.example.bannerexample W/AudioCapabilities: Unsupported mime audio/qcelp
12-20 14:39:36.067 30022-30096/com.google.android.gms.example.bannerexample W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
12-20 14:39:36.070 30022-30096/com.google.android.gms.example.bannerexample W/Utils: could not parse long range '175-174'
12-20 14:39:36.072 30022-30096/com.google.android.gms.example.bannerexample W/AudioCapabilities: Unsupported mime audio/qcelp
12-20 14:39:36.073 30022-30096/com.google.android.gms.example.bannerexample W/AudioCapabilities: Unsupported mime audio/evrc
12-20 14:39:36.078 30022-30096/com.google.android.gms.example.bannerexample W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2
12-20 14:39:36.080 30022-30096/com.google.android.gms.example.bannerexample W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2
12-20 14:39:36.085 30022-30096/com.google.android.gms.example.bannerexample W/VideoCapabilities: Unsupported mime video/wvc1
12-20 14:39:36.087 30022-30096/com.google.android.gms.example.bannerexample W/VideoCapabilities: Unsupported mime video/wvc1
12-20 14:39:36.088 30022-30096/com.google.android.gms.example.bannerexample W/VideoCapabilities: Unsupported mime video/divx
12-20 14:39:36.089 30022-30096/com.google.android.gms.example.bannerexample W/VideoCapabilities: Unsupported mime video/divx311
12-20 14:39:36.090 30022-30096/com.google.android.gms.example.bannerexample W/VideoCapabilities: Unsupported mime video/divx4
12-20 14:39:36.103 30022-30096/com.google.android.gms.example.bannerexample W/VideoCapabilities: Unsupported mime video/mp4v-esdp
12-20 14:39:36.120 30022-30096/com.google.android.gms.example.bannerexample I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
12-20 14:39:36.132 30022-30072/com.google.android.gms.example.bannerexample V/FA: Connection attempt already in progress
12-20 14:39:36.159 30022-30125/com.google.android.gms.example.bannerexample D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-20 14:39:36.168 30022-30022/com.google.android.gms.example.bannerexample D/ActivityThreadInjector: clearCachedDrawables.
12-20 14:39:36.212 30022-30125/com.google.android.gms.example.bannerexample I/OpenGLRenderer: Initialized EGL, version 1.4
12-20 14:39:36.263 30022-30125/com.google.android.gms.example.bannerexample E/HAL: hw_get_module_by_class: module name gralloc
12-20 14:39:36.263 30022-30125/com.google.android.gms.example.bannerexample E/HAL: hw_get_module_by_class: module name gralloc
12-20 14:39:36.328 30022-30072/com.google.android.gms.example.bannerexample D/FA: Connected to remote service
12-20 14:39:36.328 30022-30072/com.google.android.gms.example.bannerexample V/FA: Processing queued up service tasks: 2
12-20 14:39:41.351 30022-30072/com.google.android.gms.example.bannerexample V/FA: Inactivity, disconnecting from the service
12-20 14:39:46.335 30022-30056/com.google.android.gms.example.bannerexample W/Ads: There was a problem getting an ad response. ErrorCode: 0
12-20 14:39:46.337 30022-30022/com.google.android.gms.example.bannerexample W/Ads: Failed to load ad: 0