TUTORIAL: Add HTML to Android App

When you’re creating an Android App there is a high chance you’ll have to add html to android. For example a Help content or FAQ page. You can also use html in android, but you’ll have to add an assets folder in Android Studio (your project) before you can start using html in your Android Application.

In this tutorial I’ll show you how you add html to android app.

 


tutorial: Add HTML to Android App

Before we start; open your Android project in Android Studio. Or download Android Studio here.

  1. Right click on “app” in the upper left corner.
  2. Click New 
  3. Click Folder
  4. Click Assets Folder
assets folder android
assets folder android

Lets not change the Target Source Set unless you know what you’re doing.

  • Click Finish
html android studio
html android studio
  1. Right click Assets
  2. Click New
  3. Click File
add html to android app
add html to android app
  • Name your html file and add .html
add html android studio
add html android studio

Add your html content or copy your html file from your PC to Android Studio.

You can use the index.html file by adding the following code snippet to your MainActivity.java

WebView view = new WebView(this);
view.getSettings().setJavaScriptEnabled(true);
view.loadUrl("file:///android_asset/index.html");
setContentView(view);

For more Webview classes click here.

FIX: No JVM installation found

Are you getting this error launching android studio, or a different application that needs java?

This is a common error for when your application cannot find the JVM installation. Have you actually installed the JDK? If not please go here. If you did, but the application can still not find Java, please follow steps below.

Below the post I’m explaining why I got this error message.

“Error launching Android Studio

No JVM installation found. Please install a 64-bit JDK. If you already have a JDK installed, define a JAVA_HOME variable in Computer > System Properties > System Settings > Environment Variables.”

Screenshot (Application I’m launching is Android Studio)
Error launching android studio

Solve ‘no JVM installation found’.
  1. Go to start
  2. search for ‘This PC’
  3. right click ‘This PC’
  4. Click ‘Properties’

search this pc properties


Search for ‘Advanced System Settings’ on the left side of ‘system’. Click it. Advanced system properties

The next window should be opened on the ‘Advanced’ tab. If not click ‘Advanced’ > ‘Environment Variables…’system properties - environment variables

Add a new ‘system variables‘. environment variables - new...

Edit the System Variable: 

  • Variable name: JAVA_HOME
  • Variable value: D:\Program Files\Java\JDK1.7.0_79edit system variable

Note: This is where my issue started to happen. Ive got 2 Windows 10 installations on my laptop, but since I can reach both SSDs I don’t want to install an application twice. I copied the shortcut(android studio) from the D:\ on my Desktop and when opened up it gave this error. The JAVA was also installed on the D:\ disk and that’s why my variable value path is going to the D:\Program Files instead.

You’ll have to reload any application that needs JAVA before you can use it, because no changes will be seen until a re-start.

FIX: No emulator Android Studio

PANIC: HOME is defined but could not find Nexus_5_API_22_x86.ini file in $HOME\.android\avd

You’re receiving this error because Android Studio cannot find your emulator. The reason I’m getting this error is because I’m using my OneDrive as default.

C:\Users\Wortell\OneDrive\AppData\Local\Android\Sdk\tools\emulator.exe -avd Nexus_5_API_22_x86 -netspeed full -netdelay none
PANIC: HOME is defined but could not find Nexus_5_API_22_x86.ini file in $HOME\.android\avd
(Note: avd is searched in the order of $ANDROID_AVD_HOME,$ANDROID_SDK_HOME \.android\avd and $HOME\.android\avd)

error android studio emulator

Quick steps

  • Go to your home folder, and follow the next steps. They should be almost the same: C:\Users\wortell\OneDrive\.android\avdnexus emulator
  • Copy the android emulators
  • Go to C:\%username%\.android\avd
  • Paste them in there
  • Open Android Studio and try to run an emulator.

Is it now working or are you getting a different error? please comment below the error and I’ll try to help you.

Did this post help you out? Please share on social media.


are you following my blog and you’ve no idea what android studio is?

Android Studio is an integrated development environment (IDE) for developing for the Android platform. It was announced on May 16, 2013 at the Google I/O conference. Android Studio is freely available under the Apache License 2.0.

Android Studio was in early access preview stage starting from version 0.1 in May 2013, then entered beta stage starting from version 0.8 which was released in June 2014. The first stable build was released in December 2014, starting from version 1.0.

Based on JetBrains’ IntelliJ IDEA software, Android Studio is designed specifically for Android development. It is available for download on Windows, Mac OS X and Linux, and replaced Eclipse Android Development Tools (ADT) as Google’s primary IDE for native Android application development.

Source: Wikipedia.org