Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: [email protected]
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

Take our 85+ lesson From Beginner to Advanced LLM Developer Certification: From choosing a project to deploying a working product this is the most comprehensive and practical LLM course out there!

Publication

How to Run an Android Application from the Command Line!
Latest   Machine Learning

How to Run an Android Application from the Command Line!

Last Updated on July 20, 2023 by Editorial Team

Author(s): Garima Nishad

Originally published on Towards AI.

Android, Programming

Image Courtesy: Google

Have you ever got tired of having low RAM on your PC while using IDE?
or?

Have you ever wanted to run a single script and run all of your applications in a go?

If the answer is β€œYes” to any of those questions then you’re in the right place! You won’t need any IDE to run your android application anymore! No more hanging up!

Isn’t that amazing? Let’s get into it then!

This article outlines the usage of popular tools used for Android development on the command line, in particular, Android, Android Debug Bridge (ADB) and how they can be utilized to build an Android application project and how to install and debug an Android app using the command line.

Requirements:

  1. Install the latest Java Development Kit (JDK) from Oracle.
  2. Install the latest Android SDK. If you have not done so yet, you can download the Android SDK on Android Developers.

So let’s begin :

  • Open the terminal.
  • To start the process, first, display a list of available Android device(s) that are currently configured, copy this command:
<your android sdk directory>/tools/android list devices

Then you’ll see something like this :

and then you’ll have your list of devices:

Now you can monitor your β€œANDROID EMULATOR”

<your android sdk directory>/tools/emulator -avd <name of avd>

If you don’t know the name of your avd yet, don’t worry! You can find it out using this command:

<your android sdk directory>/tools/android list avd

You’ll see something like:

So the β€œName β€œ part would be used to replace <name of avd> in the command line:

<your android sdk directory>/tools/emulator -avd <name of avd>

I’m assuming here that you’ve already created your android project.

Now let’s compile the android project:

Before you compile your project, you must be connected to the internet in order for the Gradle wrapper script to download the appropriate Gradle software components. Once ready, to compile your Android project, navigate to your project directory on your command line (change directory), and do this:

For Mac or Linux-

./gradlew build ()

For Windows:

gradlew.bat build

Now upload a specified APK file from your computer to an emulator/device.

<your android sdk directory>/platform-tools/adb install -r <your APK file>

If this doesn’t work then push the APK using ADB:

adb push <your android app directory>/build/outputs/apk/debug/app-debug.apk /data/local/tmp/org.tensorflow.lite.examples.classification

Then start launcher:

adb shell am start -n β€œorg.tensorflow.lite.examples.classification/org.tensorflow.lite.examples.classification.ClassifierActivity” -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

The logcat command of ADB is used to display system information of a running Android OS (whether device or emulator). This is remarkably helpful to find out what is happening to an application or a device.

<your android sdk directory>/platform-tools/adb logcat

And there you have it, your working android application from the command line!

Screaming with joy yet?

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.

Published via Towards AI

Feedback ↓