16

我已经使用 create-react-native-app 创建了一个应用程序,但我不确定如何将其发布到 Google Play 商店。

错误 1

阅读此文档后。

; exp build:android
[exp] Making sure project is set up correctly...
/[exp] Warning: Not using the Expo fork of react-native. See https://docs.expo.io/.
\[exp] Warning: 'react-native' peer depencency missing. Run `npm ls` in /var/www/html/test/testme/osmosis-seek-android to see full warning.
[exp] 
[exp] If there is an issue running your project, please run `npm install` in /var/www/html/test/testme/osmosis-seek-android and restart.
[exp] Your project looks good!
[exp] Checking if current build exists...

[exp] No currently active or previous builds for this project.

? Would you like to upload a keystore or have us generate one for you?
If you don't know what this means, let us handle it! :)
 false
[exp] Starting build process...
[exp] Publishing...
[exp] Published
[exp] Your URL is

https://exp.host/@kenpeter/osmosis-seek-android

[exp] Building...
[exp] Must specify a java package in order to build this experience for Android. Please specify one in app.json at "expo.android.package"
4

2 回答 2

24

使用create-react-native-app您创建的项目有两条通往 Google Play 商店的路径。

使用 Expoexp build命令

一种方法是使用 Expo(我从事的一个项目)exp命令行工具来构建 APK。exp命令行工具(和 XDE GUI 程序)可以加载使用 CRNA 创建的项目。设置完成后,您可以exp build:android在几分钟内运行并接收 APK。

第一次执行此操作时,您必须将一些信息添加到expo.jsonapp.json(无论您拥有)APK 所需的信息。具体来说,您需要像这样指定 Java 包名称(重要的是它是一个有效的 Java 包名称!):

{
   android: {
       package: "com.example.myapp"
   }
}

这些是关于构建 APK(和 iOS 的 IPA)的文档:https ://docs.expo.io/versions/latest/guides/building-standalone-apps.html

手动弹出并构建 APK

另一种方法是使用 CRNA 的eject命令,它会为您创建 Xcode 和 Android 项目文件。然后,您将创建一个 APK 并将其提交到 Play Store,就像任何其他 React Native Android 应用程序一样。这种方法的缺点之一是,在您从 CRNA 中退出后,您将无法使用 CRNA 的工具,并且将来不会为您处理升级。

于 2017-03-23T05:12:24.893 回答
6
{
  "expo": {
    "sdkVersion": "26.0.0",
    "name": "TongPos",
    "description": "your app desc",
    "android": {
      "package": "com.sohagfaruque.xxxx"
    }
  }

}

请像上面提到的那样编辑您的 app.json。这对我有用。

于 2018-04-12T09:28:06.843 回答