How to run and test an Android App on a Virtual Device?

In the last tutorial you learned how to build a basic Android App using Android Studio. Once you have created the App how can you test it ? Or how can you run it ?

For this we use the Emulator which comes with Android SDK. It simulates a real world Android Device. Alternatively if you have an Android device like a smartphone then you can run the app on that as well. It’s fairly easy.

Let’s look at how to use the Emulator. Please refer to the below video to understand the steps needed.

To get started you will have to setup Android Virtual Device in the Android Studio. For this open the Android Virtual Device Manager from Android Studio. You can setup multiple Virtual Devices and use any of them to run the App as long as it’s compatible.

In the next tutorial we will see what happens behind the scene when you run the App.

Project Structure and Key files in the Android App Project

In the earlier tutorial we created an Android App Project using the Android Studio. In this video tutorial we look at the key files which are part of the Android Project.

We look at the Activity file, the layout file and also talk about the role of Gradle which helps build and deploy the App.

MusicLM will soon let you generate Music from Text

Google recently released a research paper titled “MusicLM: Generating Music From Text“.

What’s notable is that experiments show that MusicLM outperforms previous systems both in audio quality and adherence to the text description.

Sample Audio

MusicLM has been trained on a dataset of 280,000 hours.

A bunch of samples produced by the Model have also been shared on the following site.

There are still ethical challenges that needs to be dealt with.

Android App Development Basics | Install Android Studio | Activities and Layouts

Key Concepts

  1. Activities
    We use Activity to define what the App does. Like when we click on a button what needs to happen can be defined using an Activity. It’s a class written in Kotlin.
  2. Layouts
    To define how a screen in your App will look like we use an XML file. A screen can have various elements like images, text etc.

We use Layouts to define the UI and Activities to define the behaviour. Similar to what we do with websites – HTML, CSS and Javascript.

Like if you need to add a button then we use Layout to specify its position on screen and Activity to add functionality.

We bundle all these files together and that’s what an App is.

What happens when you start an App ?

Sequence of events when you start an Android App

  1. When you start an Android App the main activity is called.
  2. This tells Android to use a particular Layout.
  3. The layout is displayed on the device.
  4. The user interacts with the layout.
  5. The activity responds to these interactions, and updates the display.

Why Kotlin ?
It’s preferred because of additional features and it’s concise nature.

Why Android Studio ?
It includes a set of code editors, UI tools and templates, which are all designed to make development easier and faster.
It also comes with Android SDK which is needed to develop Apps. It includes Android source code and also a compiler to compile the code you write to Android format.

Getting Started

Install Android Studio from https://developer.android.com/studio

Build the App – follow the video

  1. Create a new project
  2. Select a project template – Choose the Empty Activity option.
  3. Configure the project – Specify the app name, package name and save location. Be careful with the version you select. We will discuss more on this in future blog, but you need to consider which versions of Android you want the app to be compatible with. If you specify that the app is only compatible with the very latest version of the SDK, you might find that it can’t be run on many devices.

That is it, your first app is ready. Congratulations !!

Tech Stack for Native Android Development

What is a Native Android App ?

When your App is built to run on Android devices only. The advantages of building a Native app includes high performance, access to native APIs and features and better user experience. The disadvantages may include longer development time, higher development costs and platform-specific development.

What Tools and Technologies can be used to build a Native Android App ?

For native Android development, you can use the following tools and technologies

  1. Java or Kotlin programming languages – Both Java and Kotlin are popular programming languages for Android development. While Java has been the traditional language for Android development, Kotlin is gaining popularity due to its concise syntax and modern features.
  2. Android Studio – Android Studio is the official Integrated Development Environment (IDE) for Android app development. It comes with a set of tools and features that simplify the development process and speed up app development.
  3. Android SDK – The Android SDK is a collection of software development tools and libraries required for building Android apps. It includes tools for developing, debugging, and testing Android apps.
  4. Android Jetpack – Android Jetpack is a set of libraries and tools that help developers build high-quality apps faster. It includes components for handling UI, background processing, navigation, and more.
  5. Firebase – Firebase is a mobile and web application development platform that provides a range of features and services to simplify the app development process, such as real-time databases, push notifications, authentication, and analytics.
  6. Third-party libraries – There are various third-party libraries and tools available for Android development that can help you add functionality to your app or speed up development. Some popular ones include Retrofit for network communication, Glide for image loading and caching, and Dagger for dependency injection.

These are some of the most commonly used tools and technologies for native Android development. You can use them to create high-quality and feature-rich Android apps.

Steps to create a Native Android App

Let’s look at the steps to create a simple Native Android App

  1. Set up your development environment: To develop native Android apps, you’ll need to download and install Android Studio, which is the official IDE for Android development. Android Studio comes with the Android SDK and all the necessary tools you need to build and test your app.
  2. Create a new Android project: After setting up your development environment, create a new Android project in Android Studio. This will generate a default app structure with a basic user interface.
  3. Design the user interface: Android Studio comes with a visual layout editor that allows you to drag and drop UI elements onto the screen and customize their properties. Use this editor to create the user interface for your app, and add functionality to the UI elements by writing code in Java or Kotlin.
  4. Write your app logic: Once you’ve designed the user interface, write the code that handles user interactions and performs the necessary tasks to make your app work. This might include retrieving data from a database or web service, processing user input, or manipulating media files.
  5. Test your app: After you’ve finished writing your app, test it on a physical Android device or an emulator to ensure that it works as expected. Android Studio comes with a built-in emulator that allows you to test your app on various Android versions and device configurations.
  6. Publish your app: Once you’ve tested your app and made any necessary changes, you can publish it on the Google Play Store, which is the official app store for Android. To publish your app, you’ll need to create a developer account, submit your app for review, and follow Google’s guidelines for app publishing.

Which Tech Stack can be used to create an Android App

There are various tech stacks you can use to build an Android App. The choice depends on the requirements, skills and preferences.

Here are some popular options

  1. Native Android Development
    This approach uses Java or Kotlin programming languages, Android Studio, and the Android SDK to create high-performance, feature-rich, and user-friendly apps for Android devices. This is the recommended approach for building complex and feature-rich apps that require optimal performance and integration with the platform.
  2. Hybrid App Development
    This approach uses web technologies such as HTML, CSS, and JavaScript to create cross-platform apps that can run on multiple platforms, including Android. Popular hybrid app development frameworks include React Native, Ionic, and Xamarin.
  3. Progressive Web Apps (PWA)
    PWAs use web technologies to create app-like experiences that can run on any device with a web browser, including Android devices. PWAs offer benefits such as offline capabilities, push notifications, and access to device features like camera and microphone.

As you can see, the best tech stack for your Android app depends on the specific requirements of your project.

You should consider factors such as development time, performance, scalability, maintainability, and user experience when making your decision.

In the next article we dive more into “Native Android Development” tech stack.

What is Blitzjs and Why you should use it?

Introduction
BlitzJS is a full stack framework. In simple terms it’s NextJS with additional features to make a developers life easy.

Quick Recap of NextJS (a Full Stack framework)

  1. Server side rendering feature – good for SEO.
  2. Page based Routing
  3. Lets you create backend API’s.

Why Blitz then?

But when you create a new NextJS app it’s totally bare-bones. You need to spend time adding basic stuff like eslint, prettier etc.

This is where Blitzjs shines. It makes building a web application fun and easy.

Key features

  1. No APIs needed
    You can import server side code to frontend directly, no API’s needed. Blitz does all the hard work for you. Alternatively you can continue using REST or GraphQL API’s to fetch data.
  2. Authentication
    When you create a new application with Blitz you get Authentication feature out of the box. Features like Login, Signup and Forgot Password. This can save you lot of time as setting up authentication is not only time consuming but also tricky.
  3. Code Scaffolding
    The initial code is scaffolded for you but doesnt limit you. This can save you tons of time. That said you are free to change it the way you like.
    To add additional modules there are recipes. Like if you want to add tailwind or material-ui it’s just one command away.

In the next article I will share steps to create a simple application using Blitzjs.

Warren Buffett shares his love for Reading

A common trait that can be seen in successful people like Bill Gates, Elon Musk and Warren Buffett is their love for reading. They grew up reading heavily and still continue to do that. Be it reading fiction, biographies and what not.

In an interview when Warren Buffett was asked how he keeps up to date with so much information coming his way he shared his love for reading. He said he spends 5 to 6 hours everyday just reading books.

Warren Buffett on his love for Reading

What surprised Mark Zuckerberg, at his 2005 Harvard Lecture

Back in 2005 Mark Zuckerberg took a “Computer Science” lecture at Harvard.

He started by talking about some of the strategies that Facebook used to improve its performance, one of them being caching.

After talking for a while he asked the audience for any questions. To his surprise there weren’t any technical questions as such. Well anyone will be surprised I guess. After answering a few questions he finally commented “No CS Questions”.

Watch this clip, which is quite funny !