我在此处找到Android Studio - SDK is out of date or is missing templates我需要在SDK工具中进行更新。
我看不到Firebase的选项。
我遵循了AdMob说明。显示403“无法展示广告”错误,然后我将广告单元类型切换为“横幅广告”并使用了测试横幅广告单元ID "ca-app-pub-3940256099942544/6300978111"
。
我在主要活动中的onCreate:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MobileAds.initialize(this, "my addmob id ");
mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
initialiseView();
}
My layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111"
android:layout_below="@+id/linearLayout">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
和我的日志:
W/GooglePlayServicesUtil: Google Play Store is missing.
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
W/GooglePlayServicesUtil: Google Play Store is missing.
W/GooglePlayServicesUtil: Google Play Store is missing.
W/GooglePlayServicesUtil: Google Play services is missing.
W/GooglePlayServicesUtil: Google Play Store is missing.
W/GooglePlayServicesUtil: Google Play Store is missing.
I/Ads: Starting ad request.
I/Ads: Use AdRequest.Builder.addTestDevice("C8DCA36186E6C4138C4E71BB102F78D2") to get test ads on this device.
W/GooglePlayServicesUtil: Google Play Store is missing.
W/GooglePlayServicesUtil: Google Play Store is missing.
W/Ads: Invoke Firebase method getInstance error.
W/Ads: The Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires the latest Firebase SDK jar, but Firebase SDK is either missing or out of date
W/GooglePlayServicesUtil: Google Play Store is missing.
W/GooglePlayServicesUtil: Google Play Store is missing.
W/System: ClassLoader referenced unknown path: /system/app/webview/lib/x86
W/art: Before Android 4.1, method double java.util.concurrent.ThreadLocalRandom.internalNextDouble(double, double) would have incorrectly overridden the package-private method in java.util.Random
W/art: Before Android 4.1, method int java.util.concurrent.ThreadLocalRandom.internalNextInt(int, int) would have incorrectly overridden the package-private method in java.util.Random
W/art: Before Android 4.1, method long java.util.concurrent.ThreadLocalRandom.internalNextLong(long, long) would have incorrectly overridden the package-private method in java.util.Random
I/WebViewFactory: Loading com.android.webview version 51.0.2704.91 (code 275509110)
I/cr_LibraryLoader: Time to load native libraries: 6 ms (timestamps 8593-8599)
I/cr_LibraryLoader: Expected native library version number "51.0.2704.91", actual native library version number "51.0.2704.91"
D/MediaPlayer: setSubtitleAnchor in MediaPlayer
D/MediaPlayer: setSubtitleAnchor in MediaPlayer
D/MediaPlayer: setSubtitleAnchor in MediaPlayer
I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzflm>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/customtabs/CustomTabsServiceConnection;
I/art: at boolean com.google.android.gms.internal.zznn.zzi(android.content.Context) ((null):-1)
I/art: at void com.google.android.gms.internal.zzabv.<init>(android.content.Context, com.google.android.gms.internal.zzabu) ((null):-1)
I/art: at java.lang.Object com.google.android.gms.internal.zzabx.call() ((null):-1)
I/art: at void com.google.android.gms.internal.zzago.run() ((null):-1)
I/art: at java.lang.Object java.util.concurrent.Executors$RunnableAdapter.call() (Executors.java:428)
I/art: at void java.util.concurrent.FutureTask.run() (FutureTask.java:237)
I/art: at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1133)
I/art: at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:607)
I/art: at void java.lang.Thread.run() (Thread.java:761)
I/art: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.customtabs.CustomTabsServiceConnection" on path: DexPathList[[zip file "/data/app/zapbear.quantumproductions.com.zappybear-2/base.apk"],nativeLibraryDirectories=[/data/app/zapbear.quantumproductions.com.zappybear-2/lib/x86, /system/lib, /vendor/lib]]
I/art: at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
I/art: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
I/art: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
I/art: at boolean com.google.android.gms.internal.zznn.zzi(android.content.Context) ((null):-1)
I/art: at void com.google.android.gms.internal.zzabv.<init>(android.content.Context, com.google.android.gms.internal.zzabu) ((null):-1)
I/art: at java.lang.Object com.google.android.gms.internal.zzabx.call() ((null):-1)
I/art: at void com.google.android.gms.internal.zzago.run() ((null):-1)
I/art: at java.lang.Object java.util.concurrent.Executors$RunnableAdapter.call() (Executors.java:428)
I/art: at void java.util.concurrent.FutureTask.run() (FutureTask.java:237)
I/art: at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1133)
I/art: at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:607)
I/art: at void java.lang.Thread.run() (Thread.java:761)
I/art: [ 11-20 01:41:39.886 2681: 2681 D/ ]
HostConnection::get() New Host Connection established 0xd9e15090, tid 2681
V/WebViewChromiumFactoryProvider: Binding Chromium to main looper Looper (main, tid 1) {f36c082}
I/cr_LibraryLoader: Expected native library version number "51.0.2704.91", actual native library version number "51.0.2704.91"
I/chromium: [INFO:library_loader_hooks.cc(143)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_BrowserStartup: Initializing chromium process, singleProcess=true
E/ApkAssets: Error while loading asset assets/natives_blob_64.bin: java.io.FileNotFoundException: assets/natives_blob_64.bin
E/ApkAssets: Error while loading asset assets/snapshot_blob_64.bin: java.io.FileNotFoundException: assets/snapshot_blob_64.bin
D/libEGL: Emulator has host GPU support, qemu.gles is set to 1.
E/libEGL: load_driver(/system/lib/egl/libGLES_emulation.so): dlopen failed: library "/system/lib/egl/libGLES_emulation.so" not found
D/libEGL: loaded /system/lib/egl/libEGL_emulation.so
D/libEGL: loaded /system/lib/egl/libGLESv1_CM_emulation.so
D/libEGL: loaded /system/lib/egl/libGLESv2_emulation.so
E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008d57
W/cr_media: Requires BLUETOOTH permission
I/cr_DRP: No DRP key due to exception:java.lang.ClassNotFoundException: com.android.webview.chromium.Drp
D/cr_Ime: [InputMethodManagerWrapper.java:30] Constructor
W/cr_AwContents: onDetachedFromWindow called when already detached. Ignoring
D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
I/cr_Ime: ImeThread is not enabled.
E/libEGL: validate_display:99 error 3008 (EGL_BAD_DISPLAY)
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
[ 11-20 01:41:40.059 2681: 2747 D/ ]
HostConnection::get() New Host Connection established 0xf2e305a0, tid 2747
I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
[ 11-20 01:41:40.076 2681: 2779 D/ ]
HostConnection::get() New Host Connection established 0xd54ee1b0, tid 2779
W/EGL_emulation: eglSurfaceAttrib not implemented
W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xd9ee1e80, error=EGL_SUCCESS
V/assigned screenW: 1080.0
V/The jump force is: 21.637500000000003
E/chromium: [ERROR:gles2_cmd_decoder.cc(2167)] [GroupMarkerNotSet(crbug.com/242999)!:54DB7FD8]GL ERROR :GL_INVALID_OPERATION : BackFramebuffer::Create: <- error from previous GL command
W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 2681
D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
I/chromium: [INFO:CONSOLE(0)] "Document was loaded from Application Cache with manifest https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.appcache", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
I/chromium: [INFO:CONSOLE(0)] "Application Cache Checking event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
I/chromium: [INFO:CONSOLE(0)] "Application Cache NoUpdate event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html (0)
W/GooglePlayServicesUtil: Google Play services is missing.
D/cr_Ime: [InputMethodManagerWrapper.java:30] Constructor
W/cr_AwContents: onDetachedFromWindow called when already detached. Ignoring
D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
W/Ads: Not enough space to show ad. Needs 320x49 dp, but only has 320x0 dp.
E/chromium: [ERROR:gles2_cmd_decoder.cc(2167)] [GroupMarkerNotSet(crbug.com/242999)!:5420DED3]GL ERROR :GL_INVALID_OPERATION : BackFramebuffer::Create: <- error from previous GL command
I/cr_Ime: ImeThread is not enabled.
W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 2681
D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
W/Ads: Not enough space to show ad. Needs 320x49 dp, but only has 320x0 dp.
I/Ads: Scheduling ad refresh 60000 milliseconds from now.
D/cr_Ime: [InputMethodManagerWrapper.java:30] Constructor
W/cr_AwContents: onDetachedFromWindow called when already detached. Ignoring
D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
I/cr_Ime: ImeThread is not enabled.
I/Ads: Ad finished loading.
但是我没有看到任何广告,只是我的应用程序。