• 2 days ago
hey welcome to my podcast

#Podcastshow
Transcript
00:00So, in this video, I'm going to split this into two videos. In this video, the main purpose
00:06is to show you how we generate APKs using React Native. But before we get to that, I'd
00:15like to explain that the iOS and Android folders are created automatically by React Native
00:25Community CLI. We rarely edit any files there, but we need to be in those directories to
00:35create an iOS application like now, an App Store application, or an Android APK. So the
00:43only code we edit is any now JavaScript code. For example, index.js is our entry point,
00:51and app.js is the first screen that's introduced to the user whenever they open the application.
00:57You can see it's registered here as AppRegistry.RegisterComponent. AppName is just an import from app.json,
01:05and app is just this component. So I'm not really sure what you meant by asking where
01:13you place JavaScript code, but following that direction, I believe this is what you
01:24wanted to know, but this is the first page rendered when the app is opened, whatever
01:32is defined here. So we can see inside here, we have a drawer navigator with a component,
01:41a stack navigator, and the stack navigator has SplashScreen as its initial route name.
01:48So as we follow that, we'll find out that SplashScreen is the first screen that is opened,
01:55but whatever is actually rendered is the output of app.js. In the next video, I'll deeply
02:01explain the code structure of this application, but it's not really different from what you
02:09had before with Expo. It's just that it's using CLI with the pages or screens placed
02:16in the screens directory. So when it comes to generating an Android APK, I'll just go
02:23to our app. This is the directory I've opened in Visual Studio Code, and we have an Android
02:28directory, and then app, build, outputs, APK, release folder, and we have a release APK
02:38So first, let me remove that one. To remove any APK you've created, you do gradleo. Sorry,
02:46you cannot do gradleo here. What you do is you change to the Android directory, and then
02:52you do .slash gradleo, assemble, release. And what this has done, it's just created
03:10a new version of this app-release.apk. So you can check 526, you can check here, we
03:19can check the properties, and it was created at 526. So if we want to remove it, so that
03:32we start again on a new page, we do .slash gradleo, clean, which will clean that directory,
03:47and you see in my file explorer, the directory does not exist anymore. So when we want to
03:55generate now this release APK, we do .slash gradleo, assemble, just like I did last time.
04:06And it takes quite a while. It will take approximately 10 to, not really 10, maximum
04:1910 minutes for this type of application. These warnings are normal, they happen. They
04:42are actually beyond you or me as the developer, they're just part of how React Native works.
04:50So we don't really care about what we can't really have total control of. So what's happening
05:12right now is Gradle, the build system is bundling our APK with a lot of, with, not really with,
05:24but bundling together the different parts that will generate an APK for us.
06:12Once it completes, now we go back to, so I can just take you from tour app, unread, app, build,
06:30outputs, APK, release, and we have our release APK. And this is what I usually send to you on
06:42Apple. You can even see the file size is 72 megabytes. Please allow me to share this today.
06:48I'm reading for some exams that are happening very early in the morning tomorrow. And then
06:54after that exam, I'll come in and create this video. No, not this one. I'm not create a separate
07:02video that is really talking about how the code is structured. But the key points I do want us to
07:11take from this video is one, you'll have to, you'll have to change directory to Android so that you
07:20can build an APK. We can skip this part. This one I just did to confirm it's working. I really
07:27intended to start with Gradle clean. Clean will remove whatever has been generated, whether it's
07:34a debug, whether it's a release application. We can do Gradle assemble debug, which will generate
07:41an APK that's not really bundled up well. And the APK will be like 190 megabytes. And I just thought
07:47that is not really making a lot of sense to send 190 megabytes over the internet while you can send
07:5272. So clean, clean everything. And then assemble release will assemble a release APK, while
08:00assemble debug will assemble a debug APK.