genymotion-gradle-plugin


Source link: https://github.com/Genymobile/genymotion-gradle-plugin

Gradle Plugin for Genymotion

Gradle Plugin Documentation

Here is a short description on how to use the Gradle plugin for Genymotion into your build.gradle.

Including the plugin

To use our plugin, you need first to reference our plugin’s repository. Here is what your build.gradle should look like:

buildscript {

  repositories {

jcenter()
  
}

  dependencies {

classpath 'com.genymotion:plugin:1.4'
  
}
 
}

Then, apply the plugin. Insert this line into your build.gradle:

apply plugin: "genymotion"

Using the plugin

When this is done you can access to the Genymotion’s Gradle features. You can open a genymotion section and start defining your devices like this:

genymotion {

  devices {

nexus5 {

 template "Google Nexus 5 - 4.4.4 - API 19 - 1080x1920"

}

  
}
 
}

This simple example will create and launch a Nexus 5 running KitKat right before the connectedAndroidTest task.

You can also use the plugin to run your tests in Genymotion Cloud. To add a cloud device, use the following syntax:

genymotion {

  cloudDevices {

nexus5 {

 template "Google Nexus 5 - 4.4.4 - API 19 - 1080x1920"

}

  
}
 
}

This will create a Nexus 5 device on Genymotion Cloud.

But this plugin can do a lot more, read the full documentation for an exhaustive explanation.

Downloading the plugin's source code

To download the plugin, run:

git clone --recursive https://github.com/Genymobile/genymotion-gradle-plugin.git

Project description

The plugin folder contains the Gradle plugin.

The samples folder contains the example project using the Gradle plugin. There is one sample called 'helloworld' that showcases how to use the Gradle plugin in the context of an Android app.

Compiling the plugin

To compile the plugin, go to the root project folder and run the following command:

./gradlew :plugin:uploadArchives

The build result is a Maven repository. It will be pushed into a new folder: repo

You can now use the plugin as a simple repository. To add it to your project, you must add these lines to your build.gradle file:

buildscript {

  repositories {

maven {
 url uri('<path/to/local/repo>') 
}

  
}

  dependencies {

classpath 'com.genymotion:plugin:+'
  
}
 
}

Give it a try

Execute the sample "helloworld" using this command:

cd samples/helloworld ./gradlew connectedAndroidTest

This starts a virtual device on your computer.

Contributing

The Gradle Plugin for Genymotion is an open source project under GPL v3 license.

Pull requests are strongly encouraged.

You can learn more about the plugin architecture in the architecture document.

Unit testing the project

Before pulling, you need to run the unit tests on the project. You can run it with the command:

./gradlew :plugin:test

As some tests are using the Android Gradle plugin, you need to have the Android SDK installed and the ANDROID_HOME environment variable set to be able to run all the tests.

Optional integration tests

This project also contains integration tests.

Before running these tests you need gmtool, the command line tool for Genymotion. It is embedded in the Genymotion app bundle.

The integration tests rely on a default.properties file where all needed properties can be read. This can be addressed in two ways. Either you create such file (ideal when working locally) or you inject all the needed properties via command line argument (ideal for CI):

Method 1:

  1. Copy the plugin/res/test/default.properties.TEMPLATE file and name it default.properties
  2. Fill the new file with your information (genymotion username, password, license) and the path to your local Genymotion installation (genymotionPath).
  3. Also, in the file plugin/res/test/android-app/local.properties precise the sdk.dir field with your Android SDK path

Method 2:

Add the following command line arguments when running the tests:

./gradlew <taskName> -Pusername=<username> -Ppassword=<password> -Plicense=<license> -PgenymotionPath=<path-to-genymotion>

Then launch the integration tests with this command:

./gradlew :plugin:integrationTest

Or launch all the tests (unit & integration) with this command:

./gradlew :plugin:check

Resources

A simple TextView that is styled like a label.

A drop-in AppCompatButton for integrating with Lyft.

Reactive database connection for Android based on ORMLite.

This library allows to use "switch" button.

A sliding navigation bar.

A simple, clean, and powerful Android logger.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes