How to generate APK from an Expokit project?

Asked

Viewed 1,151 times

0

I was with an Expo project, but due to the need to apply payment methods I had to eject the project to have the folders /android and /Ios to edit them directly. I decided to use React-Native-iap, so I ejected to an Expokit project, as it is recommended by the Expo documentation as it continues to use Expo properties, as opposed to a full ejection. So... I did the edits right, but how do I generate the app apk? Since 'expo build:android' does not work in this type of project.

1 answer

0


1 - Put Keystore on android/app

2 - Change one of the files : ~/. Gradle/Gradle.properties or android/Gradle.properties by changing to your Keystore configs:

MYAPP_RELEASE_STORE_FILE=minha_key.keystore
MYAPP_RELEASE_KEY_ALIAS=minha_key-alias
MYAPP_RELEASE_STORE_PASSWORD=*****
MYAPP_RELEASE_KEY_PASSWORD=*****

3 - Edit android/app/build.Radle and add the variables above:

...
android {
    ...
    defaultConfig { ... }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            ...
            signingConfig signingConfigs.release
        }
    }
}
...

4 - To generate :

$ cd android
$ ./gradlew assembleRelease

APK will be on : android/app/build/outputs/apk/release/app-release.apk

Any questions, see here : https://facebook.github.io/react-native/docs/signed-apk-android#docsNav

  • Thanks bro, I’ve already managed to generate. My problem now is to run on my cell phone or emulator, I created a question and if you can help me I really appreciate it, I’m stuck in it and I don’t know how to solve: https://answall.com/questions/347821/howto run a project-expokit-num-cellular-emulatordevelopment And due to the delay, I have created one on the English website with more details: https://stackoverflow.com/questions/53695334/how-to-fix-error-permission-denial-when-executing-command-react-native-run-an Help me, please

  • good! but if the answer was helpful, it is always good to thank...

  • Strange, I thought I had upvote on the answer

  • Good! I sent a link to your other question, as you did an Ject, it might help you

  • Before generating the production . apk use the command expo publish to leave their JS in a CDN of the Expo itself.

  • @Luídne I already gave the expo Publish, but when I Gero the apk, I install on my mobile and try to run it says the app can not be loaded. Some solution?

  • Checks the Urls in the android project (Mainactivity.java) if it is the same that appears at the end when running expo publish

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.