Hey folks, are you looking for android studio build apk tutorial to turn a website an app - If yes, then you have come to the right place.
As you would know, website is a very valid source to attract any audience, but in today's era it is necessary to make app along with website so that phone users can also use your product and services and for that you may need a good platform to make apps. On the Internet, you will find many such options by which you can convert a website into an app, one of which is Android studio.
In this article, we'll learn how to convert a website into an app or build an app by using Android studio but before that let's take a overview about Android studio.
Android Studio Overview
Android Studio is an IDE (Integrated Development Environment) which is specially designed for android development like Android apps. Android Studio is initially released on june 2014 by the Google & JetBrains. Android studio is designed and developed with the motive of creating and building high quality apps. Android studio is available for Windows, macOS, linux and Chrome OS.
Now, let's discuss about how to turn a website into an app or build an app by using Android studio.
How to turn website into app using Android studio (URL to App)
Here, we will discuss step by step guide on how to convert a website into an app or build an app by using Android studio. So, let's dive in!
• Download and Install Android studio
This will be the first step where you will have to download Android Studio. It is good to say that we have already published tutorial on Android Studio download and installation - click here to know how to download and setup Android Studio on windows 10.
• Create a New Project
Now, open the Android Studio app and then click on "New Project". After clicking on New Project, a new popup will appear on your computer screen where you have to choose the template of your app. Now, simply choose the option of "Empty activity" and click on "Next" button to continue.
After selecting the "Empty Activity" template, a new popup will appear on your computer screen, in which you will have to select your app name, package name, programming language and minimum SDK.
Now, you choose the name of your app - always keep in mind that the name of the app should match with the name of your website. After this you have to choose the bundle of your app - like com.example.appname. And after that, you have to select the language in which you want to code your app. I strongly suggest you to choose java programming language. After all this, you need to select Minimum SDK - Simply Select "API 21: Android 5.0 (Lollipop)" and click on "Finish" button to create project. If you are facing any difficulty in this process, then you can consult from the image given below.
• Copy and paste codes
You will have to do some coding in this step - don't worry, in this article you will find links to Java code that you can easily copy and paste into the Android Studio IDE. But before coding, one thing should be kept in mind that if you made any mistake at the time of coding, then you will have to repeat this process again.
After creating a new project on Android Studio, you will reach its main source code editing interface where you will show the files of mainactivity.xml and mainactivity.java - Now you have to code in mainactivity.xml first. For that click on the main activity.xml file then select the code option. Now replace the code from <textview............constraintlayout> (with new code - click here!! To get mainactivity.xml code).
After pasting this code, you will get some error that will be visible you in red bold letters. To resolve this error, simply right click on red color text > show context Actions > Add dependency on androidx.swipefreshlayout:swipefreshlayout. After selecting this option, additional downloading will start in your Android Studio. After downloading this file, error will be solved automatically.
Now, click on mainactivity.java file and replace the code below "Package com.example.applicationname" with new code. Click here!! To get mainactivity.java code.
After pasting the code, you have to do two simple things - first you have to enter the url of your website in it. For that, at the starting of this code, you will get to see the "sting website URL" code line - you just have to replace this link and enter the url of your website which you want to convert into app. And secondly, you have to fix the error of "swiperefreshlayout" which is showing you in red color - to fix this error, simply right click on red color text > Show > import class. After doing this, swiperefreshlayout error will automatically fix.
Now you have to open new file i.e., AndroidManifest.xml - for this, go to left hand side column and search for manifests and open it. After opening this folder click on AndroidManifest.xml file to open this file on editor. Now, you have to replace all the coding starting below package"com.example.applicationname"> line.
Click here!! To get AndroidManifest.xml code. Huraahhh!!!! Your coding work is almost done.
• Remove unwanted header bar
After pasting the codes, you have to review the app by pressing the play button once. Here, you will see that your app has an extra header. Now you'll need to remove this header - it's quite simple, you just need to find the res folder on it, then click on res > Values > themes. Now, in this folder you will be showing two themes.xml files. You have to open both these files one-by-one and make minor changes. Such that "DarkActionBar" replace to "NoActionBar".
• Add logo to your app (Configure image asset)
Your app is almost ready, there is only one thing to do i.e. add logo to your app. For that you have to click on the name of res > New > Image Assets.
Now, you will see that the window tab of configure image asset will open in your computer screen. All you have to do is click on "frontground" then find the Browse option and click on it. And then, you have to upload the logo. After the logo is uploaded you have to resize and customize it and then click on "next" to save logo.
• Generate APK file on Android studio
Your app is successfully created, now all you have to do is convert it into apk format and save it to the local library which is a very easy task, you just have to go to the top of the computer screen, then click on build > Generate signed bundle or APK.
After clicking on Generate signed bundle or APK, you will land in the new interface which will appear in your computer screen like this. Here, you have to select "Android App Bundle" and press the Next button. You can also save apk file by choosing "apk" option but you cannot publish it in app store - so you have to go with first option.
After clicking "Android App Bundle" you will land in the new interface which will appear something like this on your computer screen;
In this step you have to click on "create new" button to create new key store, so simply click on it.
Now, a new tab will pop-up on your screen – just fill all the details after that press "Enter" or "Ok" to Create key store.
Huraahhh!!! Its all done You just have to enter the password of the new key store and the apk will be automatically stored in your library.
Above we have discussed about how to convert a website into an app or build an app by using Android studio. Android Studio is an IDE (Integrated Development Environment) which is specially designed for android development like Android apps. Android Studio is initially released on june 2014 by the Google & JetBrains. Android studio is designed and developed with the motive of creating and building high quality apps. By properly following the above mentioned steps anyone can easily convert a website into an app or build an app by using Android studio.