当我尝试在 Google Play Console 中上传我的 App Bundle 时,出现以下错误:
“上传之前从清单中删除冲突。其他开发人员正在使用以下内容提供程序权限:com.####.firebaseinitprovider、com.####.reactnativefirebaseappinitprovider。”
网上搜索,我发现我应该更改“AndroidManifest.xml”中的名称 但我的 AndroidManifest 不包含任何具有该名称的提供程序
我的 AndroidManifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
我尝试添加这样的提供者:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<provider
android:name="com.example.firebaseinitprovider"
android:authorities="com.exemple.myapp.provider"
android:exported="false">
</provider>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
但是如果我这样做,我的应用程序将不再启动,我可能做错了什么。
我使用该库的官方文档没有提到这个问题或如何做到这一点。 我使用的库:https://rnfirebase.io
我应该怎样做才能解决这个问题?
TL;DR:您配置的应用程序 ID 和/或由您的依赖项组装的授权 ID 可能不是唯一的,并且已被其他开发人员使用(在 Google 看来 - 即您可能没有使用正确的签名)证书/帐户)。
注意:这是我自己对构建管道的研究结果,这项研究的结果可能不会得出正确的结论。但由于您还没有从其他人那里得到答案,我至少会发布我的研究,直到主题专家可以权衡。
如文档所述:
重要提示:一旦发布应用程序,您就不应更改应用程序 ID。如果您更改应用程序 ID,Google Play 商店会将上传视为完全不同的应用程序。如果您想上传应用程序的新版本,则必须使用与最初发布时相同的应用程序 ID 和签名证书。
在继续阅读之前,最好检查您是否使用正确的 Google 帐户(例如工作帐户和个人帐户)进行发布,并且您还想确保您使用的是上次发布时使用的相同签名证书(例如可能使用过另一台计算机)。
如果上述评论不适用,您可以继续检查项目的配置。
您尚未指定您正在使用哪个构建工具,因此我假设您正在遵循 Android App Module 文档并使用 Gradle 版本。
您的项目的
build.gradle
文件将如下所示:
// this example is for Groovy (see link for Kotlin)
android {
defaultConfig {
applicationId "com.example.myapp" // <-- this line is important
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
...
}
什么是
applicationId
?
该文件中的 applicationId
值决定了您的应用程序的永久 ID。作为最佳实践,您的应用程序 ID 应嵌套在您拥有的反向 Web 域下。如果您打算发布多个应用程序,您还想为您的应用程序附加一个唯一的名称。如果您拥有
example.com
,您可以使用:
com.example
(有效,但不推荐,除非您只发布一个主应用程序)
com.example.android
(好的)
com.example.app
(好吧,如果
app.example.com
是一个实际网站也很有用)
com.example.project
(好吧,允许不同的层/项目 - 例如
com.example.free
、
com.example.fitness
或
com.example.lite
)
com.example.project.app
(理想的选择,对于客户项目和分组项目组件特别有用)
io.invertase.firebase.*
-
invertase.io
是他们的网站,
firebase
是项目,然后将特定组件添加到末尾(例如
app
、
auth
、
firestore
等)。
applicationId
如何使用?编译应用程序时,您选择的
applicationId
将由每个兼容依赖项的
AndroidManifest.xml
文件添加为权限。例如,这些行出现在
的
firebase/firebase-android-sdk
中:
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:authorities="${applicationId}.firebaseinitprovider"
android:directBootAware="true"
android:exported="false"
android:initOrder="100" />
类似的条目可以在的
invertase/react-native-firebase
中找到:
<provider
android:name="io.invertase.firebase.app.ReactNativeFirebaseAppInitProvider"
android:authorities="${applicationId}.reactnativefirebaseappinitprovider"
android:exported="false"
android:initOrder="99" /> <!-- Firebase = 100, using 99 to run after Firebase initialises (highest first) -->
这些行允许这些 SDK 将数据传入和传出您的应用程序。
要纠正此问题,您需要确保您有权更新现有应用程序或更改您的应用程序 ID 并使用您问题中的原始
AndroidManifest.xml
。根据您的问题,您当前的
applicationId
是
com.####
,请考虑将其更改为
com.####.topic
、
com.####.app
、
com.####.chat
等