Building an Android APK with React Native Expo | Tutorial EAS Build
Вставка
- Опубліковано 26 січ 2025
- Join us in this tutorial as we create an APK for Android.
React Native Course 👉🏼 codewithbeto.d...
For resources go to Code With Beto 👉🏼 codewithbeto.dev
My new channel 👉🏼 / @codewithbeto1
Join the Discord: / discord
👨🏻💻 ☕️ 🌟 Would you like to support me? Sponsor me on GitHub🌟 ☕️ 👨🏻💻
github.com/bet...
⭐️ If you want to learn more about me, check this links:
Twitter: / betomoedano
Instagram: / betomoedano. .
Github: github.com/bet...
Linkedin: / betomoedano
Discord: / discord
Code With Beto: codewithbeto.ve...
Medium: / betomoedano01
Figma: www.figma.com/...
My channel in Spanish: / betomoedano
⭐️ My apps & projects:
► Code With Beto: codewithbeto.v...
► Eco Studios: ecodev.netlify...
⭐️ Contact: betomoedano@outlook.com
if it is crush after lounch then remove node modules and package-lock install packages using yarn and then during build check errors and in my case it was about add package react-native-screens
thanks buddy really needed this
Big Big thank you man . I really appreciate your comment . My app crashes after lunch but after deleting the node_module,packgae-lock and reinstalling them with the yarn solve the crashing problem. But while using yarn i have to install the missing packages manually and this is somthing annoying to me. But anyways thank you --> user-dm2kl7dw2h
just posted a comment regarding this if people are experiencing the same thing. These comments also helped me!!
i have done every thing following the video and the docs, but after installing the app it remains at the start page that expo gives, io don't know what is the problem does any one solved it?
Build failed: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
how to resolve this problem?
When encountering a Gradle build failure with an unknown error, it can be challenging to pinpoint the exact cause without additional information or error logs. However, here are some general troubleshooting steps you can follow to resolve the issue:
Check the error logs: Look for the specific error message or stack trace provided in the logs for the "Run gradlew" phase. The logs can usually be found in the console output or in a separate log file. Understanding the specific error message can help you identify the root cause of the problem.
Verify Gradle version: Ensure that you are using a compatible Gradle version for your project. Check the Gradle documentation or the project's documentation to determine the recommended Gradle version. You can also try updating Gradle to a newer version if you are using an outdated one.
Check for dependency conflicts: Gradle builds can fail due to conflicts between different dependencies. Use the dependency management features of Gradle to analyze and resolve any conflicts. You can try excluding or updating specific dependencies to resolve conflicts.
Clean and rebuild: Sometimes, build failures can be caused by corrupt or outdated build artifacts. Try cleaning the project build by running gradlew clean or ./gradlew clean (depending on your operating system) before attempting to rebuild. This will remove any previously generated build files and start with a clean slate.
Internet connectivity: Gradle relies on internet connectivity to download dependencies and plugins. Ensure that you have a stable internet connection and that any necessary proxies or firewalls are properly configured.
Check for build script errors: Review your Gradle build scripts (build.gradle or build.gradle.kts) for any syntax errors or misconfigurations. Pay attention to the tasks, dependencies, and plugins specified in the build scripts.
Gradle wrapper: If you are using the Gradle wrapper (gradlew or gradlew.bat), make sure it is properly configured and up to date. You can try updating the Gradle wrapper by running gradlew wrapper --gradle-version X.Y.Z (replace X.Y.Z with the desired Gradle version).
Seek help: If you have tried the above steps and the issue persists, consider seeking help from the Gradle community or the specific project's support channels. They may be able to provide more targeted guidance based on the error logs or project-specific configuration.
Remember to provide as much relevant information as possible when seeking assistance, such as the error message, relevant portions of the build script, and any additional context that might be helpful in diagnosing the problem.
can you please tell me if the APK file will run on my Android phone?
I am getting error android build failed can you please resolve it ?
Not sure if my previous comment got deleted, but here are my steps to how I fixed the APK file crashing when installing on physical device.
Note: I used Expo SDK 51 and only built on Android for testing/school purposes.
1. Delete node modules and package.lock (optional: I also deleted android folder)
2. Run yarn install to download most dependencies, but some you will have to install manually such as these ones:
- yarn add react-native-gesture-handler
- yarn add react-native-reanimated
- yarn add react-native-safe-area-context
- yarn add react-native-screens
- yarn add react-native-pager-view
3. run npx expo-doctor to check if any dependencies are still missing or need to be updated
4. I added my env variables to eas.json, not sure if you have to do this too but here is what mine looks like for Preview build
"preview": {
"distribution": "internal",
"android": {
"buildType": "apk"
},
"env": {
"API_BASE_URL": ,
// other env variables if you need to add
}
},
5. then I run eas build:configure and eas build -p android --profile preview
6. go to the EAS dev site to check your build, if it fails during run gradlew you can check the logs and see if any other dependencies are missing.
Hope this helps.
i have the problem. yet to try ur solution. but thanks for sharing man . helpful
@enochdollar-bill3306 no problem, hopefully it works! Good luck
getting this error "Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0."
how can i come over this
im using EXPO sdk 51 to make the build for my application
Thanks for the useful video!
Can you share how did you changed the app icon? I can't seem to change it no matter what I try.
I changed it in the app.json file and ran eas update but the icon doesnt change.
Help please🙏
Im having problems with asynstorage in the Apk when I install the file in my Android phone, for some reason the the asynstorage doesn't save any value, Did anyone have the same problem?
Linking local project to EAS project d7fc23b1-48ad-47da-a3ae-xxxxx3f7xxxx
No config exists
Error: build:configure command failed.
So in Windows using EAS we can only target android simulator but not iOS?
Then what is the benefit of using Expo over react native cli?
Yes you can target android, this tutorial is just for android
i couldn't explore more on the eas.json file and was not able to edit on it just like what you're doing on your screen but my eas build was successfully created for all device .what can i do ?
Better English than some guys, Beto ... congrats 😀👍
By the way, can you explain how to run and configure that Emulator on the right side on the screen, man. Thanks in advance 😀👍
Thanks bro! Do you mean the IOS simulator? You just need to download Xcode 👍👍
@@codewithbeto OK... in MacOS but in Windows is it possible? 🤔 I guess so. Thanks for your answer, my man 😀👍
@@javiersistemas is not possible on windows
@@codewithbeto ohhh boy 😨😨😨 ... that's so sad 😞 ... Anyway, thanks for your time, man and I'll keep supporting you, brother 😃😃
@@javiersistemas thanks Javier I appreciate you
Hi! I have a question, how you configure the environment variables for development and production? I read the documentation and it says you have to pass them in thw eas.json file, but when I do it and build my preview android apk, it doesn't works
show me ur eas.json code
Did you solve it?
@@wendigo6372 yes I figured it out, I was able to set 3 environments, in my case development, preview and production. Also I found a way to change the App name depending of this one
{
"cli": {
"version": ">= 6.0.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"env": {
"EXPO_PUBLIC_API_EXAMPLE": "",
"EXPO_PUBLIC_API_EXAMPLE_2": ""
},
"android": {
"buildType": "apk"
}
},
"preview": {
"distribution": "internal",
"android": {
"buildType": "apk"
},
"env": {
"EXPO_PUBLIC_API_EXAMPLE": "",
"EXPO_PUBLIC_API_EXAMPLE_2": "",
"APP_VARIANT": "preview"
}
},
"production": {
"env": {
"EXPO_PUBLIC_API_EXAMPLE": "",
"EXPO_PUBLIC_API_NODO_EXAMPLE_2": ""
},
"android": {
"buildType": "apk"
}
}
},
"submit": {
"production": {}
}
}
That is the structure I use for eas.json. The important thing to set the correct prefix variable in env object, is a must to type the EXPO_PUBLIC_API_ . Another thing is the APP_VARIANT, is optional, but this will help you as a environment variable to be able to change some dynamic values (in my case de name of the app), I will comment an example
When i run this command in my terminal eas build:configure it says zsh: command not found: eas, how to fix it ?
You need to install the expo CLI, refer to the expo documentation for instructions 👍
am i doing th enpm install in my project folder or do i do it through git?
I have a problem that the apk after build, and install it, the app crashed, it is open and close in the same moment, what is the problem?
I have the same
There is 30 free builds a month in free plan, does it mean i can only run my app 30 times in visual code? That would be insane if there is 5 people working on app amd we daily open amd run it like 50 times
As I understand it, it is not about running the app in Visual Studio Code, but rather about building it, which means that one can build the Android app up to 30 times and the iOS app up to 15 times. Trust me, I've run my own expo app more than 500 times in a month with Visual Studio Code. In other words, it's not about running an app, but about building an apk. I hope my response was helpful.
Hi, I can't create an account when I create it, I get an error message, can you help me, thank you for your answer. Peter
So, how do you pass the point with the node version problem? It seems like there's nothing I can do. It's literally the first problem, yet I can't seem to find a solution. How did you solve this?
Can you provide more context to this problem? I’m not sure what error you are referring
@@codewithbeto Sure. Expo doesn't support the LSV of Node, but not even the latest version, but the last 3 versions. I believe Node v16 and below are supported by Expo. Has something to do with Node using different hashing for security, I dunno. So my question is, is there a way around it? Or is the only way to downgrade node to version that supports Expo?
It should work with node 18 but you can try using a node version manager like nvm to quickly change between node versions in your computer. I hope this helps
"You have reached the concurrency limit. Build is waiting to enter the queue. "hello what is this error sir?
you have to wait more for your build because another are in the queue
mine is telling me android bundle failed , run "grandlew " 😭😭😭 please help me I need this
Sometimes you just have to try again.
did u found a solution?
did you try to install into a android device? because I tried and comes with an error and I have to specify that I'm using windows OS
Did your app crashes as soon as you open your apk? And how to fix it.Plz help bro
@@arpanbajpai1226 I have the same issue... Did you find a solution?
@@emirozdemir9060 any of you found a solution?
my app crashing too when i start@@arpanbajpai1226
can you tell me what is the name of android simulator and where can i download
I get error with: Linking local project to EAS project
IS it Debug apk? if yes then is it possible throught create-react-native-app?
Bro when i launch apk through my android phone it crashes and doesnt open what to do?
Did the problem resolved?
Try building the apk again, sometimes that happens
Any updates on this?
My app works via Metro but it crashes after splash screen when I try to launch it via apk. 😭
Is your problem resolved?plz help me.
@arpanbajpai1226 yep yep. I figured it out via creating a new project. In the new project I realized that I made some mistakes in previous project. For example, my way of installing packages was wrong. I used to installing packages using "npm install" but the right way is "npx expo install nameOfPackageYouWannaInstall"
It was the main problem. Also, there were other problems with layout. I had some red errors but it worked via Metro. But unfortunately it doesn't work via apk. Make sure your project doesn't have errors.
@@EdikTVSet My project is almost error free.I am able to build and install the apk file in my physical android but as soon as i open it,it crashes and takes it to the Android interface.I dont know how to fix it.
@arpanbajpai1226 try to create a new empty project. Then build it. Does it work? If so, great. Start adding new content step-by-step, build and test project. This way you will find the problem cuz one time you will get a wrong build. And you will know the reason why
@@EdikTVSet Ok bro I wanna this method may be it will work.Thnx
no worries for English bro, it's perfect
apk crash everytime while open , what's the solution ??
same
That doesn't work anymore
I am getting eas not recognize command
The link generated for downloading apk is unreachable
Sometimes you just need to try again 😅
Ok, but I tried several times but still failed. Thank you for replying me
my apk opens and closes
Check my comment that I just posted on this video if you are experiencing this still
why the apk 60mb for only hello world
me to facing with same issue
@@shahbazimma now i understand, the size of the eas build is not the same as playstore build, in the playstore, it should be around 9-11 mb in the latest SDK
what about on windows?
apk crash everytime while open
same for me !!
did you solve this error
i get an AAB file instead of an apk, any help?
add this to the "preview" object
"android": {
"buildType": "apk"
}
please how can i add env file
Let us know if you publish the course in English! I'd buy in a heartbeat
The course is almost entirely available in English now! You can see the progres here codewithbeto.dev/learn
Thank you.🎉
You bet!
The link generated for downloadingi
how to build for ios?
post React Native CLI Videos
ver helpful, tu ver much!
Work this video😀😀😀😀
thank you
bro english courses are very important
Definitely
English Bro English Plz Plz 😇😇😇😇😇😇😇
Hack
English or Spanish 😂
😂
Compressing project files :- failed to upload the project tarball to eas build.
Reason :- cannot copy 'C:\Users\***' to a subdirectory of itself,
Help ?
hi facing same issue
can u let me know how u resolved it ?
i tried to build the app but upon installing in on an android device the app is stuck on the splash screen.
same error
Same error
When i install .apk file into android phone. it installs, but when i open it says 'app stops' and never start
Mine too, did you fix it? How?
how did you fix it?@@hudsonmenezesdev
@@hudsonmenezesdevhappened to me, I had to check the build logs to figure it out, might be dependency issues or even the images you are using for icon, adaptive-icon etc
specifically check the "expo run doctor" part of the build logs and also "run gradle"
It might be caused due to dependency issue, happened to me
Did you fix it?