npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-android-emulator

v0.1.6

Published

Create, Start, Unlock, Stop Android emulators, Install APK, Start Activities

Downloads

6

Readme

grunt-android-emulator

Build Status NPM version

This project contains a Grunt plugin which includes tasks to:

  • Create an Android emulator
  • Start an Android emulator
  • Stop an Android emulator
  • Unlock an Android emulator
  • Install an APK
  • Start an activity

Getting Started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-android-emulator --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-android-emulator');

create-android-emulator task

This task creates an Android emulator. You can execute it using:

grunt create-android-emulator:emulator-1 where emulator-1 is a the emulator's id as shown in the below configuration.

grunt.initConfig({
    grunt_android_emulator: {
        emulators: [{
            id: 'emulator-1',
            create: {
                '--name': 'testAVD',
                //'--sdcard': '10M',
                //'--snapshot': '',
                //'--path': 'avd',
                '--force': '',
                //'--skin': '',
                '--target': 'android-18',
                '--abi': 'armeabi-v7a'
            }
        }]
    }
});

Options

--name or -n

Type: String
Description: Name of the new AVD
Usage: [required]

--target or -t

Type: String
Description: Target ID of the new AVD
Usage: [required]

--path or -p

Type: String
Description: Directory where the new AVD will be created
Usage: [optional]

--force or -f

Type: -
Description: Forces creation (overwrites an existing AVD)
Usage: [optional]

--skin or -s

Type: String
Description: Skin for the new AVD
Usage: [optional]

--device or -d

Type: String
Description: Device definition to use
Usage: [optional]

--abi or -b

Type: String
Description: The ABI to use for the AVD
Usage: [optional]

--sdcard or -c

Type: String
Description: Path to a shared SD card image, or size of a new sdcard for the new AVD
Usage: [optional]

--snapshot or -a

Type: String
Description: Place a snapshots file in the AVD, to enable persistence
Usage: [optional]

start-android-emulator

This task starts an Android emulator. You can execute it using:

grunt start-android-emulator:emulator-1 where emulator-1 is a the emulator's id as shown in the below configuration.

grunt.initConfig({
    grunt_android_emulator: {
        emulators: [{
            id: 'emulator-1',
            start: {
                '-port': '5556',
                //'-no-window': '',
                '-no-audio': '',
                // '-force-32bit': ''
                //'-no-boot-anim': '',
                //'-no-skin': '',
                //'-memory': '1024'
                //'-avd': 'testAVD'
            }
        }],
    }
});

Options

-port

Type: String
Description: TCP port that will be used for the console
Usage: [optional]
Default: 5554

-memory

Type: String
Description: Physical RAM size in MB
Usage: [optional]

-avd

Type: String
Description: AVD name
Usage: [optional]
Default: The --name or -n value of the emulator's create options

-no-audio

Type: -
Description: Disable audio support
Usage: [optional]

-no-skin

Type: -
Description: Don't use any emulator skin
Usage: [optional]

-no-boot-anim

Type: -
Description: Disable animation for faster boot
Usage: [optional]

-no-window

Type: -
Description: Disable graphical window display
Usage: [optional]

Execute emulator -help in a terminal to see a list of the available options. Note that the -ports option is not supported

stop-android-emulator

This task stops an Android emulator. You can execute it using:

grunt stop-android-emulator:emulator-1 where emulator-1 is a the emulator's id.

unlock-android-emulator

This task unlocks an Android emulator. You can execute it by using:

grunt unlock-android-emulator:emulator-1 where emulator-1 is a the emulator's id.

The plugin uses the -port option of the start options to find the emulator to stop or 5554 in case this option is not defined.

install-apk task

This task installs an APK in an Android emulator. You can execute it using:

grunt install-apk:emulator-1:apk-1 where emulator-1 is a the emulator's id and apk-1 is the APK's id as shown in the below configuration.

grunt.initConfig({
    grunt_android_emulator: {
        emulators: [{
            id: 'emulator-1',
            create: {
                '--name': 'testAVD',
                //'--sdcard': '10M',
                //'--snapshot': '',
                //'--path': 'avd',
                '--force': '',
                //'--skin': '',
                '--target': 'android-18',
                '--abi': 'armeabi-v7a'
            }
        }],
        apks: [{
            id: "apk-1",
            path: "./apk/test.apk",
            activities: [{
                id: "activity-1",
                packageName: "org.jboss.aerogear",
                name: "AeroGearMain"
            }]
        }]
    }
});

Options

path

Type: String
Description: Relative or absolute path of the APK
Usage: [required]

start-activity task

This task starts an activity. You can execute it using:

grunt start-activity:emulator-1:apk-1:activity-1 where emulator-1 is a the emulator's id, apk-1 is the APK's id and activity-1 is the activity's id as shown in the below configuration.

grunt.initConfig({
    grunt_android_emulator: {
        emulators: [{
            id: 'emulator-1',
            create: {
                '--name': 'testAVD',
                //'--sdcard': '10M',
                //'--snapshot': '',
                //'--path': 'avd',
                '--force': '',
                //'--skin': '',
                '--target': 'android-18',
                '--abi': 'armeabi-v7a'
            }
        }],
        apks: [{
            id: "apk-1",
            path: "./apks/test.apk",
            activities: [{
                id: "activity-1",
                packageName: "org.jboss.aerogear",
                name: "AeroGearMain"
            }]
        }]
    }
});

Options

activities[x].id

Type: String
Description: Identifier of the activity
Usage: [required]

activities[x].packageName

Type: String
Description: Package name
Usage: [required]

activities[x].name

Type: String
Description: Activity name
Usage: [required]

Example

The example folder contains a sample example which depicts how to use this plugin.

Release History

0.1.6

Released 12 March 2017

  • Fix bug during starting activities

0.1.5

Released 16 January 2016

  • Update shelljs dependency NPM version

0.1.2

Released 08 September 2014

  • Remove validation from create options --device option support

0.1.1

Released 13 December 2013

  • Add APK installation and start activity support

0.1.0

Released 20 October 2013

  • Initial release