Java 每次我添加google.android.gms:play-services-ads:18.1.0都会失败
每次我添加:Java 每次我添加google.android.gms:play-services-ads:18.1.0都会失败,java,api,android-studio,admob,android-manifest,Java,Api,Android Studio,Admob,Android Manifest,每次我添加: implementation 'com.google.android.gms:play-services-ads:18.1.0' 在我的依赖项中,我遇到以下错误: ERROR: Manifest merger failed with multiple errors, see logs 我曾尝试创建另一个项目,它给了我同样的结果。每次我添加dependencie时,我都会遇到在清单中合并的问题。 我尝试将其取出,错误消失,但当我尝试在手机上测试我的应用程序时,应用
implementation 'com.google.android.gms:play-services-ads:18.1.0'
在我的依赖项中,我遇到以下错误:
ERROR: Manifest merger failed with multiple errors, see logs
我曾尝试创建另一个项目,它给了我同样的结果。每次我添加dependencie时,我都会遇到在清单中合并的问题。
我尝试将其取出,错误消失,但当我尝试在手机上测试我的应用程序时,应用程序在启动前崩溃,我得到以下结果:
java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
******************************************************************************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
* should follow the instructions here: to add a valid *
* App ID inside the AndroidManifest. Google Ad Manager publishers should *
* follow instructions here: . *
******************************************************************************
at android.app.ActivityThread.installProvider(ActivityThread.java:5265)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4847)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4787)
at android.app.ActivityThread.access$1600(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1452)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:234)
at android.app.ActivityThread.main(ActivityThread.java:5526)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.IllegalStateException:
******************************************************************************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
* should follow the instructions here: to add a valid *
* App ID inside the AndroidManifest. Google Ad Manager publishers should *
* follow instructions here: . *
******************************************************************************
这里到底有什么问题?我该怎么解决呢?
这是我的舱单
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher_kv"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_kv_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".WelcomeYou"></activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.example.com"
android:pathPrefix="/example"
android:scheme="http" />
android:host="example"
android:scheme="example" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
您需要将此标签添加到AndroidManifest.XML中:
<application>...
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
</application>
致:
在build.gradle应用程序上
我不知道为什么,但18.1.1版的内容如下:
implementation 'com.android.support:appcompat-v7:26.1.0'
有一个我无法修复的错误。。。复制品什么的
这对我有用。希望你能解决这个问题。Fast fix:implementation'com.google.android.gms:play services广告:17.2.1'
implementation 'com.google.android.gms:play-services-ads:18.1.1'
implementation 'com.google.android.gms:play-services-ads:17.2.1'
implementation 'com.android.support:appcompat-v7:26.1.0'