当我安装 Admob 和 Firestore 软件包时,我在 com.google.android.gms:play-services-measurement-api:22.1.2 中收到错误“property#android.adservices.AD_SERVICES_CONFIG@resource=@xml/gma_ad_services_config`”与 apk 构建过程中的另一个值发生冲突。根据我的研究,我将以下内容添加到 AndroidManifest.xml 文件中以防止冲突:
<property
android:name="android.adservices.AD_SERVICES_CONFIG’
android:resource="@xml/gma_ad_services_config’
tools:replace=‘android:resource’ />
我添加了这些行并得到了 apk 构建过程,没有任何问题。然而,虽然展示广告没有问题,但我注意到我无法使用Firestore服务。在我对 Android Logcat 的检查中,我看到收到错误“默认 FirebaseApp 无法初始化,因为没有找到默认选项。”。
unityLibrary uild.gradle内容如下:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:12
implementation 'com.google.android.gms:play-services-ads:23.5.0' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
implementation 'com.google.android.gms:play-services-base:18.5.0' // Assets/Firebase/Editor/AppDependencies.xml:17
implementation 'com.google.android.ump:user-messaging-platform:3.1.0' // Assets/GoogleMobileAds/Editor/GoogleUmpDependencies.xml:7
implementation 'com.google.firebase:firebase-analytics:22.1.2' // Assets/Firebase/Editor/FirestoreDependencies.xml:15
implementation 'com.google.firebase:firebase-app-unity:12.4.1' // Assets/Firebase/Editor/AppDependencies.xml:22
implementation 'com.google.firebase:firebase-common:21.0.0' // Assets/Firebase/Editor/AppDependencies.xml:13
implementation 'com.google.firebase:firebase-firestore:25.1.1' // Assets/Firebase/Editor/FirestoreDependencies.xml:13
implementation 'com.google.firebase:firebase-firestore-unity:12.4.1' // Assets/Firebase/Editor/FirestoreDependencies.xml:20
// Android Resolver Dependencies End
implementation(name: 'googlemobileads-unity', ext:'aar')
implementation project(':unityLibrary:GoogleMobileAdsPlugin.androidlib')
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.core:core:1.9.0'
implementation 'androidx.games:games-activity:3.0.5'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.games:games-frame-pacing:1.10.0'
}
非常感谢您的帮助。
您将
google-services.json
包含在项目中的正确位置了吗?