16

I have created an app with create-react-native-app, but I am not sure how to publish it to google play store.

Error 1

After reading this doc.

; 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"
ide
  • 19,942
  • 5
  • 64
  • 106
kenpeter
  • 7,404
  • 14
  • 64
  • 95
  • http://stackoverflow.com/questions/32783344/deploy-publish-android-app-made-with-react-native – fubar Mar 23 '17 at 04:53

2 Answers2

23

With projects created using create-react-native-app you have two paths to the Google Play Store.

Use the Expo exp build command

One path is to use the Expo (a project I work on) exp command-line tool to build the APK. The exp command-line tool (and XDE GUI program) can load projects created with CRNA. After getting set up, you can run exp build:android and receive an APK in a few minutes.

The first time you do this, you'll have to add some information to expo.json or app.json (whichever you have) that's required for the APK. Specifically you need to specify the Java package name like this (it's important it's a valid Java package name!):

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

These are the docs that talk about building an APK (and IPA for iOS): https://docs.expo.io/versions/latest/guides/building-standalone-apps.html

Eject and build an APK manually

Another path is to use CRNA's eject command, which creates Xcode and Android project files for you. Then you'd create an APK and submit it to the Play Store like any other React Native Android app. One of the downsides of this approach is that after you've ejected from CRNA, you don't get to use CRNA's tools and it won't take care of upgrades for you in the future.

ide
  • 19,942
  • 5
  • 64
  • 106
  • @kenpeter From the error message it sounds like you need to specify the Java package name in your app.json file. Edited the answer to include this. – ide Mar 23 '17 at 06:06
  • not working, code here: github.com/kenpeter/osmosis_seek_android. Do you mind have a look at it for me? – kenpeter Mar 24 '17 at 11:23
  • It looks like you have both app.json and expo.json, and expo.json takes precedence. I've updated my answer to say you need only one of these files. – ide Mar 24 '17 at 19:39
  • 2
    After ejection, we can't use CRNA tools meaning we can't use all the hot reloading, debugging and stuff, right ? And what does "won't take care of upgrades for you in the future" mean ? – Karuppiah May 21 '17 at 18:02
  • @ide have you managed to successfully build an APK with the "exp build" option? I've tried, it builds an APK but it doesn't work... An attempt to launch it on phone or emulator always leads to an error "Parse Error, There was a problem parsing package" – Pavlo Kyrylenko Jan 04 '18 at 19:50
  • @Kashtan that likely indicates a problem with your project since many developers have successfully created APKs. Maybe the Android adb logs will provide more info. – ide Jan 18 '18 at 07:00
  • 1
    @ide right, I've already solved this. Was a problem with the "Java package name" - it contained numbers "com.2017......" - that's not valid package name – Pavlo Kyrylenko Jan 19 '18 at 08:30
6
{
  "expo": {
    "sdkVersion": "26.0.0",
    "name": "TongPos",
    "description": "your app desc",
    "android": {
      "package": "com.sohagfaruque.xxxx"
    }
  }

}

Please edit your app.json like above mentioned. That worked for me.