How to convert html file into apk | Sololearn: Learn to code for FREE!

+1

How to convert html file into apk

I have a good knowledge and practice of javascript. I want to publish a game but the problem is that a html file cannot be shared. I want to ask how can i convert my html code into apk.Please tell a secure and free way to do this

10/21/2020 7:14:03 AM

Raghu Rao

12 Answers

New Answer

+1

Raghu Rao, even if you switch to unity to create a game it still requires the Android Software Development Kit (SDK). Unity creates the apk by writing Java code that creates a custom main activity that will display your game then passes control to the code generated by Unity. https://docs.unity3d.com/Manual/android-BuildProcess.html If you want to write browser based games and bundle them as Android applications then you can do that. If you want to create games using Unity then you can do that too. You need to understand the build process though. I seriously wonder how many people who repeat "just use Unity" here on SoloLearn have actually gone through the process. It's rather like saying "just fly a plane" or "just perform brain surgery", a gross oversimplification. I don't know if such people are being flippant or trying to be smug.

+5

https://code.sololearn.com/Wx8a6zsqSx9v/?ref=app It is surprisingly easy.

+5

You can't convert HTML to android package(apk) like image(jpg => png) but you need to look at 👀 " app development with javascript" https://www.sololearn.com/discuss/815244/?ref=app https://www.sololearn.com/discuss/2136138/?ref=app https://www.sololearn.com/discuss/1769303/?ref=app https://www.sololearn.com/discuss/2471175/?ref=app https://www.sololearn.com/discuss/1507286/?ref=app if you can even it won't be functional app

+5

Raghu Rao I know what @frogged says, he say "downloading webview lib in Android studio and putting js and HTML " but it is not easy as image you need to download android sdk, android studio, there is also many java library you need it to run the webview as Martin Taylor mentioned it

+4

You will still require the Android Software Development Kit (SDK) to create an .apk using React Native, Cordova, or PhoneGap. All of these systems create a simple wrapper application, usually containng a WebView control, and display your JavaScript/web app insde of that. They do not perform some magical translation of web technologies into a Java application.

+2

Raghu Rao, what Ananiya Jemberu and I are trying to point out is that it is not a simple button press that magically converts html, css, and JavaScript into an Android application. The link provided by Frogged is a gross oversimplification, it skips over many of the steps and requirements of actually getting Android Studio and the Java Development Kit up and running. What is actually happening in that link, and the associated video, is the creation of an Android application using Android Studio. This application is written in Java, notice that it requests that you edit the file MainActivity.java. The main activity (window) for this application consists of a Webview control. It is this webview control that will display your html, css, and JavaScript. In actual fact what you are doing is creating a browser that uses your html as the home page and has no address bar. You are not converting your html into an apk. You are creating an application in Java that uses your html as an asset. That's why it is necessary to create the assets folder and place the html css,and JavaScript files there. Essentially you are creating a web app as detailed here... https://developer.android.com/guide/webapps I do wish people would try to understand what they are doing instead of blindly following cut and paste instructions. It seems that these days the twitter followers are incapable of reading anything longer than two lines. They should stay on twitter and leave software development to people who can think.

+1

Raghu Rao if you know reactjs then learn react native. Then you will be able to convert your react native project to apk. If you don't know reactjs or new to javascript. Use service worker and make it a progressive web app. You can host your game on netlify or GitHub. After hosting on netlify or GitHub your game will be live on internet. Now, you can share link provided netlify or GitHub to share your game. Don't forget to use webpack. So, that others can not do reverse engineering on your game.

+1

So what can I do to publish my game on playstore. I mean should I change the language to C# and start unity

+1

Or stay with js only

+1

There Are 2 Methods: 1) In Android Studio (FREE): https://youtu.be/CjiSaGWvsEU 2) MIT App Inventor (FREE): i) Upload The App Files to A Web Hosting Server: https://www.youtube.com/results?search_query=free+html+web+hosting ii) Then See This Tutorial: https://youtu.be/TesEcpLeC3g iii) Build The Apk, Enjoy! Note: Second Method Needs Internet Connection! Hope It Will Help...

0

Ananiya Jemberu I think your answer is completely wrong Check the answer of Frogged

0

Thanks alot Martin Taylor