Expo and .apk files


This week I had to make my first release build for android with Expo for my react native project. I assumed this would consist of running a command and placing the .apk file on the android emulator. I figured that would take me about 15 minutes. It ended up taking me a little bit longer.

After copy and pasting 5 or so commands into my terminal to generate the .apk, and having that fail, I realized I would have to actually read the content in those posts. I found I had to generate the android folder with expo for my application. That failed for various reasons, and I tried various fixes. What worked was having it fail, manually putting a file with the android sdk route in the half generated android folder, and running it again. Sweet, I got a .apk file.

So I go to android studio and I import the .apk. Unfortunately, I get an error regarding the android SDK. I look for a fix online for about one hour, all the solutions are for a previous version of android. Eventually I find this post by a hero on stack overflow explaining I need to click these 5 obscure android studio options to manually set the SDK for the module (whatever that means). I do that, I hit the button, the emulator shows up, YES! It shows a black box… I realize that my emulator version doesn’t correspond to the one I just set for the module. I update my emulator and this time I get… a white box. Alright. Progress.

So I figured the problem had something to do with my .apk file. I probably compiled it wrong or something. I recompile it the exact same way I did the first time and try again (as if that would do anything). Obviously it works now, except the pictures for my application are not loading. After reading a bunch of more stuff on stack overflow, I compile from inside the android folder with a different command, and everything finally works perfectly in android studio. I can now turn in my homework.

It was definitely not fun going through all of that, but I did learn a lot about using expo with react native, .apk files, and how to work with android studio. I have come to learn that hanging in there to fix an annoying problems is a big part of learning to code. Although I would prefer not go through a similar learning experience anytime soon.

See you next time!


Leave a Reply

Your email address will not be published. Required fields are marked *