问题描述
我构建了一个 React-Native android 应用并上传到 Google Play,效果很好.
I built a React-Native android app and uploaded to Google Play, which worked fine.
现在我正在尝试上传一个新版本(上传到 iTunes Connect 时没有问题),而 Google Play 给了我这个错误:您需要为您的 APK 或 Android App Bundle 使用不同的版本代码,因为您已经拥有一个版本代码为 1 的版本."
Now I have a new build I am trying to upload (had no issues uploading to itunes Connect), and Google Play is giving me this error: "You need to use a different version code for your APK or Android App Bundle because you already have one with version code 1."
每次构建后,我都会更新 app.json 中的版本,我也尝试过更新 package.json 中的版本.我已经对versionCode"进行了目录范围的搜索,但没有实例.对版本"的目录范围搜索出现了 2,000 多个结果,我滚动浏览了所有结果,没有看到任何特定于 android build 的内容.而且我对 iOS 构建没有任何问题.
After each build, I have updated the version in app.json, and I have tried updating the version in package.json as well. I've done a directory-wide search for 'versionCode' and there are no instances. A directory-wide search of 'version' turned up over 2,000 results, and I scrolled through all of them, and did not see anything specific to android build. And I did NOT have an issue with iOS build.
我曾尝试使用 Max Expo XDE 首先发布应用程序,并且我正在使用exp build:android"在命令行中构建它.
I have tried publishing the app first using Max Expo XDE, and I am building it in command line with "exp build:android".
我的 app.json 中有以下内容:
I have the following in my app.json:
{
"expo": {
"name": "Placeholder",
"sdkVersion": "27.0.0",
"privacy": "unlisted",
"orientation": "portrait",
"icon": "./assets/img/AppIcon.png",
"version": "0.3.4",
"ios": {
"bundleIdentifier": "com.placeholder.placeholder"
},
"android": {
"package": "com.placeholder.placeholder"
}
}
}
而我的 package.json 如下(并且 npm install 已经运行):
and my package.json is as follows (and npm install has been run):
{
"name": "placeholder",
"version": "0.2.0",
"private": true,
"devDependencies": {
"jest-expo": "~27.0.0",
"react-native-scripts": "1.14.0",
"react-test-renderer": "16.3.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"axios": "^0.18.0",
"expo": "^27.0.1",
"native-base": "^2.4.3",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-27.0.0.tar.gz",
"react-native-svg": "^6.3.1",
"react-navigation": "^2.0.0",
"redux-thunk": "^2.2.0",
"socket.io-client": "^2.1.0"
}
}
推荐答案
我也遇到这个问题,我通过在android下的app.json中添加versionCode解决了.例如,
I also experience this issue, I resolved it by adding versionCode to my app.json under android. For instance,
机器人":{
版本代码":2
}
"android": {
"versionCode": 2
}
注意 '2' 没有引号.
Notice that the '2' does not have quotation marks.
如果您需要了解有关 versionCode 的更多信息,请参阅此文档.
if you need know more about versionCode, see this documentation.
versionCodeOnAndroid
这篇关于Expo React-Native Android 版本未更新 Google Play 的版本代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!