[英]Android compilation error after upgrading to 'com.google.android.gms:play-services-ads:18.1.0'
[英]Implementation 'com.google.android.gms:play-services-ads:18.1.0'
我想向我的項目中添加廣告,但是當我添加以下行時,它不起作用:
implementation 'com.google.android.gms:play-services-ads:18.1.0'
這些是來自build.gradle
的依賴build.gradle
:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.google.android.gms:play-services-ads:18.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
您是否在內部對google()
庫或maven { url "https://maven.google.com" }
頂級build.gradle
文件引用? 日志中是否存在某些特定錯誤?
嘗試創建一個新項目並復制舊項目文件並粘貼到一個新項目中。 如果有幫助!
您可能沒有將Google Services Gradle插件以及google-services.json
文件(可以從Firebase控制台下載)添加到項目中-因此您的應用程序無法通過身份驗證。
將com.google.android.gms.ads.APPLICATION_ID
添加到AndroidManifest.xml
具有相同的效果,因為Play Services插件會在構建時從google-services.json
添加值。
...如果僅使用AdMob,則應首選第二個選項。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.