• This repository has been archived on 25/Mar/2022
  • Stars
    star
    125
  • Rank 286,335 (Top 6 %)
  • Language
    Java
  • License
    MIT License
  • Created over 13 years ago
  • Updated about 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An IntelliJ template project for android developers, pre-configured to work with Robolectric, Roboguice, an other common, useful Android libraries.

Current Issues/ToDos

  • Build release apks without requiring a password. This will enable auto-generation of apks in continuous integration.

Android IntelliJ Starter

This is a "template" IntelliJ project created to bootstrap Android development. We have included as many of our go-to tools and as much hard earned configuration knowledge as possible to aid new projects. This includes out-of-the-box support for robolectric, robojuice, C2DM, great-expectations, android source Jars, and other important libraries.

Configuration By Deletion

There is a lot of stuff in here, everything from android source jars to dependency injection; we acknowledge that your project might not want all of it. We encourage your project to remove whatever you don't want.

Assumptions

We make the following assumptions. Feel free to deviate but you will likely need to fix some things as you go.

  • You are working on a Mac
  • Your android SDK is in ~/android-sdk-macosx, or you are going to put it there, or create a symlink, etc.
  • Robolectric will live in submodules/robolectric inside your project directory. (We'll put it there for you.)
  • You have java, ruby and git installed

Don't open IntelliJ yet.

Summary Instructions (for Power Users)

  • Don't open IntelliJ yet. Did you already launch it? Close it.

  • Install Android to ~/android-sdk-macosx/

  • Install Android platform tools, Android 2.3.3 with Google APIs, and the most recent Android with Google APIs (needed for Robolectric). You change the Android version for your project later.

      android update sdk -u --filter platform-tools,android-10,addon-google_apis-google-10,extra-android-support,android-16,addon-google_apis-google-16
    
  • Create a local git repo for your new project, or create one on GitHub and clone it. http://help.github.com/create-a-repo/

  • Optionally, fork the robolectric repo on GitHub if you wish to use a fork for your project to make it easy to contribute changes back to robolectric. We recommend that you fork robolectric. Go to https://github.com/pivotal/robolectric and click the "Fork" button.

  • Clone the AndroidIntelliJStarter project, then add all of its code and setup to your new project's repo by running:

      git clone git://github.com/pivotal/AndroidIntelliJStarter starter_tmp
      cd starter_tmp
      ./script/setup_project YourProjectName path_to_your_project_repo #or ruby script/setup_project ...
    
      # This script will prompt you for a package name and a robolectric repo, both are optional.
      # Default package name: com.example.android.sampleapp
      # Default robolectric repo is the read-only offical robolectric repo: git://github.com/pivotal/robolectric.git
    
      # To make sure everything is OK, run tests for both Robolectric and your project:
      cd path_to_your_project_repo && (cd submodules/robolectric && ant clean test) && ant clean test
    
  • Open YourProject in IntelliJ 10.5 or higher.

  • Import IntelliJ Settings: File => Import Settings => YourProject/support/IntellijSettings.jar. This will destroy your existing IntelliJ settings!

Notes:

  • "Import Settings" should have fixed the global Project SDKs and Module SDKs. Fix them if they are still broken. See "4. IntelliJ: Some Manual Configuration" below.
  • Robolectric's unit test suite requires SDK 10 with Google APIs (2.3.3). If you do not install this SDK you cannot run Robolectric's tests.
  • Once you are done, you can delete the starter_tmp directory.

In IntelliJ, Run Unit Tests, Robolectric Unit Tests, and launch StarterApp and make sure they work.

At least glance at the stuff below about robojuice, C2DM, gp and gpp, forking robolectric, etc.

Stuck? Keep reading!

Super Detailed Instructions

Salvation lies within.

1. Android Setup

Don't open IntelliJ yet.

Download the latest Mac SDK: http://developer.android.com/sdk/index.html

Unzip the archive and move the android-sdk-macosx dir to ~/android-sdk-macosx. This project assumes that android lives in ~/android-sdk-macosx. You will need to fix paths in several places if you choose a different location.

Add the android tools to the PATH.

# Note: change .bash_profile to .bashrc or something else if needed
echo 'export PATH="$PATH:$HOME/android-sdk-macosx/tools:$HOME/android-sdk-macosx/platform-tools"' >> $HOME/.bash_profile

Open a new Terminal window and run android:

# in a new Terminal window:
android

Use the "Android SDK and AVD Manager" to download all of the SDKs. This project assumes SDK v10 (2.3.3) with Google APIs. You can change this later.

To install:

  • Available packages => Android Repository => SDK Platform 2.3.3
  • Available packages => Third party Add-ons => Google Inc => Google APIs by Google Inc., Android API 10

Install other SDKs using this method.

Virtual Devices

Make at least one Virtual Device (emulator) for the SDK(s) you installed above. Instructions at http://developer.android.com/tools/devices/index.html

Note: This project assumes you have SDK 10 with Google APIs (2.3.3) installed. You can change this in build.properties.

2. Setting Up Your New Project's Repo

Don't open IntelliJ yet.

Before you can start, you have to have a git repo for your new project on your machine.

If you are using GitHub, to create a new repo for your project, create it on GitHub and clone it to your local machine.

If you are NOT using GitHub, just create a repo on your local machine for your project (i.e. git init).

Optionally, if you are using git pair on your project, create a .pairs file in your new project's repo and run git pair.

Finally, clone pivotal/AndroidIntelliJStarter be sure to use the read-only URI to avoid accidentally pushing changes to it.

git clone git://github.com/pivotal/AndroidIntelliJStarter starter_tmp

Project Setup Script

setup_project will rename the files and file contents that need to be changed from AndroidIntelliJStarter to YourProject and copy/commit all of the files into your project's repo.

cd starter_tmp
./script/setup_project YourProject path_to_your_project_repo

This script will prompt you for a package name and a robolectric repo, both are optional.

  • The default package name is com.example.android.sampleapp.
  • Robolectric is a git submodule in this project. By default, submodules/robolectric is a non-pushable clone of http://github.com/pivotal/robolectric (HEAD). You can specify your own fork at the prompt.

We recommend that you fork robolectric for your project. For details on how to set up your fork to easily sync with pivotal/robolectric, see "Open Source Robolectric" below.

Note that Robolectric unit test require SDK v10 (2.3.3) with Google APIs. If you do not install this SDK then you will not be able to run Robolectric's own test suite.

3. IntelliJ: Settings, Libraries, and SDKs

Open YourProject in IntelliJ 10.5 or higher.

Import IntellijSettings.jar

Import support/IntellijSettings.jar to automatically configure your SDKs and other important settings:

File => Import Settings => YourProject/support/IntellijSettings.jar

If everything goes well everything will be fixed when IntelliJ restarts.

Troubleshooting: My IntelliJ SDKs are Broken!

Something about your machine's configuration does not match our settings. Manually fix all using the following instructions. Likely issues include:

  • Are you are not running IntelliJ 11.X?
  • Android SDKs are not installed in ~/android-sdk-macosx/.

If these are not the issue keep going to the SDK sections below.

Platform Settings: SDKs -- JSDK

  • File => Project Structure
  • Platform Settings => SDKs

If 1.6 is not listed, add it:

  • Add (plus sign) => JSDK
  • Take the default if you can, deep in /System/Library/.../CurrentJDK/Home

Platform Settings: SDKs -- Android SDKs

Check your Android SDKs:

  • File => Project Structure
  • Platform Settings => SDKs

Your Android SDKs are listed here. You might need to add a few. Note that if you want to run Robolectric's own test suite you will need to add Google APIs (2.3.3). For example:

  • Add (plus sign) => Android SDK
  • locate and choose ~/android-sdk-macosx
  • Select internal Java Platform: 1.6
  • Create new Android SDK: Google APIs (2.3.3)

If you need SDKs that are not listed you will need to install it via the Android SDK and AVD Manager. See above.

Module SDKs

You might need to fix the Module SDKs for YourProject and Robolectric:

  • File => Project Structure
  • Modules => YourProject => Dependencies
  • Module SDK: choose one.
  • Repeat for Modules => Robolectric => Dependencies

Highlighted Libraries And Tools

We have included several libraries and configurations that we use on most projects. You are free to keep them or remove them.

Roboguice

By default this project uses Roboguice for dependency injection. https://github.com/roboguice/roboguice

Configure dependency injection in MySampleApplication.ApplicationModule and RobolectricTestRunnerWithInjection.TestApplicationModule.

RobolectricTestRunnerWithInjection is a test runner configured to use Roboguice. See StarterActivityWithRoboguiceTest for example usage.

To remove Roboguice:

  • Delete MySampleApplication and remove references
  • Delete RobolectricTestRunnerWithInjection and remove references
  • Delete guice* and roboguice* jars in libs/main and libs-src/
  • Remove all uses of @Inject, @InjectView, etc.
  • Remove reference to MySampleApplication from AndroidManifest

Fest

We've included the Fest expectation matchers to provide Jasmine-style expectations to your project. The fest-android extensions are also included for simpler android-specific tests.

Further documentation at http://fest.easytesting.org/ and https://github.com/square/fest-android

Lots of Jars

We have added many handy Jars, such as apache commons, google's Guava, the Jackson JSON parsing libraries, and more. Check them out in libs/main/ and libs/test-- keep them or delete them.

Scripts

These Ruby scripts should make your life easier. Feel free to edit them. They assume ruby lives in /usr/bin/ruby so you might need to edit their #!/usr/bin/ruby if yours is different. Alternatively these scripts can be run with ruby explicitly: ruby script/[the script].

Be sure to check out "Project Setup Script", above, for more details on many of these scripts.

  • script/gp -- "Git Pull" script. This pulls and rebases your project and robolectric.
  • script/gpp -- "Git Pull Push" script. Same as script/gp but also runs all tests in robolectric. and your project. If they pass it will git push.
  • script/setup_project [YourProject] [path_to_your_project_repo] -- Copies AndroidIntelliJStarter into a project git repo, and gives the project a name of [YourProject].
  • script/set_package -- Change the Java package from the default to the provided package name.
  • script/init_git_repo -- create a new local git repository. Existing .git directory safely moved to .git.bak.

ant (DEPRECATED)

In addition to the built-in Android ant tasks you will likely use the following additions often. You can chain them, such as ant clean test. Feel free to edit build.xml to fit your needs.

  • ant clean -- deletes all output dirs
  • ant test -- executes the project tests

Maven

There are a couple of useful maven tasks:

  • mvn clean -- deletes all output dirs
  • mvn test -- executes the project tests
  • mvn install -- writes the target (your apk by default) to the local maven repo

Open Source Robolectric

Robolectric is open source and it continuously improves. We recommend that your project fork robolectric. By forking you have the freedom to choose when (if ever) to update to later versions of robolectric, make changes to your fork as needed, and contribute those changes back to pivotal/robolectric using the official github pull-request workflow.

Merging in pivotal/robolectric

The official Github workflow (http://help.github.com/fork-a-repo/) details how to merge another repo's code into your own fork, such as merging pivotal/robolectric into yourproject/robolectric:

Do the following once per machine:

# add pivotal/robolectric HEAD as an upstream remote
cd submodules/robolectric
git remote add upstream git://github.com/pivotal/robolectric.git

When you want to merge in upstream:

# merge pivotal/robolectric into your fork
cd submodules/robolectric
git fetch upstream
git merge --no-commit upstream/master

Then:

  • Fix merge conflicts
  • Run robolectric tests
  • Run main project tests
  • Commit robolectric and push
  • Commit project and push

Contributing Back

Make a pull request: http://help.github.com/send-pull-requests/

Changing from using the default Robolectric to using your own fork

If you started with the default (non-pushable submodule) robolectric, you can change your mind later and set up your project to use your own fork later by following these instructions.

.gitmodules -- delete the '[submodule "submodules/robolectric"]' section if present.

.git/config -- delete the '[submodule "robolectric"]' section if present.

Clean up git and directories

git rm --cached submodules/robolectric
rm -rf submodules

After forking robolectric on Github, add a submodule that points to your robolectric repository:

git submodule add ***YOUR-GIT-REPOSITORY-URI-HERE*** submodules/robolectric
git submodule init
(cd submodules/robolectric && ant clean test)

More Repositories

1

kubeless

Kubernetes Native Serverless Framework
Go
6,867
star
2

clarity

Clarity is a scalable, accessible, customizable, open source design system built with web components. Works with any JavaScript framework, built for enterprises, and designed to be inclusive.
TypeScript
6,456
star
3

octant

Highly extensible platform for developers to better understand the complexity of Kubernetes clusters.
Go
6,247
star
4

kubewatch

Watch k8s events and trigger Handlers
Go
2,448
star
5

scripted

The Scripted code editor
JavaScript
1,564
star
6

eventrouter

A simple introspective kubernetes service that forwards events to a specified sink.
Go
873
star
7

tgik

Official repository for TGI Kubernetes (TGIK)!
Shell
828
star
8

kube-prod-runtime

A standard infrastructure environment for Kubernetes
Jsonnet
776
star
9

healthcheck

A library for implementing Kubernetes liveness and readiness probe handlers in your Go application.
Go
675
star
10

pivotal_workstation

A cookbook of recipes for an OSX workstation
662
star
11

cabin

The Mobile Dashboard for Kubernetes
JavaScript
659
star
12

dispatch

Dispatch is a framework for deploying and managing serverless style applications.
Go
535
star
13

buildkit-cli-for-kubectl

BuildKit CLI for kubectl is a tool for building container images with your Kubernetes cluster
Go
491
star
14

haret

A strongly consistent distributed coordination system, built using proven protocols & implemented in Rust.
Rust
462
star
15

concourse-pipeline-samples

Sample code and recipes for Concourse CI pipelines and deployments.
Shell
447
star
16

cascade

A Just-In-Time Compiler for Verilog from VMware Research
C++
430
star
17

projectmonitor

Big Visible Chart CI aggregator
Ruby
427
star
18

kubeless-ui

Graphical User Interface for Kubeless
JavaScript
417
star
19

halite

DEPRECATED: A client-side web application interface to a running Salt infrastructure
Python
413
star
20

gangway

An application that can be used to easily enable authentication flows via OIDC for a kubernetes cluster.
Go
407
star
21

salty-vagrant

Use Salt as a Vagrant provisioner.
Shell
373
star
22

liota

Python
336
star
23

lightwave

Identity services for traditional infrastructure, applications and containers.
C
321
star
24

rbvmomi

Ruby interface to the VMware vSphere API.
Ruby
302
star
25

git_scripts

Developer workflow convenience scripts
Ruby
279
star
26

pcfdev

This is the depricated version of PCF Dev - please visit the current Github repository https://github.com/cloudfoundry-incubator/cfdev for the latest updates
Go
273
star
27

springsource-cloudfoundry-samples

Samples for Cloud Foundry
Java
259
star
28

admiral

Container management solution with an accent on modeling containerized applications and provide placement based on dynamic policy allocation
Java
254
star
29

vsphere-storage-for-docker

vSphere Storage for Docker
Python
254
star
30

salt-vim

Vim files for editing Salt files
Vim Script
246
star
31

rvc

RVC is a Linux console UI for vSphere, built on the RbVmomi bindings to the vSphere API.
Ruby
238
star
32

xenon

Xenon - Decentralized Control Plane Framework
Java
226
star
33

database-stream-processor

Streaming and Incremental Computation Framework
Rust
222
star
34

raet

Reliable Asynchronous Event Transport Protocol
Python
208
star
35

salt-cloud

Salt Cloud Working group.
200
star
36

vsphere-automation-sdk-rest

REST (Postman and JavaScript) samples and API reference documentation for vSphere using the VMware REST API
197
star
37

cloud-init-vmware-guestinfo

A cloud-init datasource for VMware vSphere's GuestInfo interface
Python
192
star
38

jsunit

The original unit-testing framework for JavaScript. These days we use Jasmine (http://github.com/pivotal/jasmine) by default for JS testing; JsUnit is not actively developed or supported.
Java
173
star
39

sql_magic

Magic functions for using Jupyter Notebook with Apache Spark and a variety of SQL databases.
Jupyter Notebook
171
star
40

purser

Kubernetes Cloud Native Applications visibility
Go
171
star
41

pyvcloud

Python SDK for VMware vCloud Director
Python
170
star
42

salt-contrib

Salt Module Contributions
Python
170
star
43

powernsx

PowerShell module that abstracts the VMware NSX-v API to a set of easily used PowerShell functions
PowerShell
170
star
44

p4c-xdp

Backend for the P4 compiler targeting XDP
C
166
star
45

webcommander

Powerful, flexible, intuitive and most importantly simple. That is what a real automation solution should be. No matter how complicated the task is, we'd like to turn it into a single click. Is that possible? Not without webcommander :)
PowerShell
166
star
46

vcd-cli

Command Line Interface for VMware vCloud Director
Python
164
star
47

wardroom

A tool for creating Kubernetes-ready base operating system images.
Python
162
star
48

pcf-pipelines

PCF Pipelines
Shell
158
star
49

spring-boot-cities

A Spring Boot + Spring Data + Spring Cloud Connectors demo app
Java
149
star
50

kube-manifests

A collection of misc Kubernetes configs for various jobs, as used in Bitnami's production clusters.
Jsonnet
136
star
51

ktx

manage kubernetes cluster configs
Shell
133
star
52

pg_rewind

Tool for resynchronizing a Postgres database after failover
125
star
53

vctl-docs

VMware vctl Docs
124
star
54

cimonitor

This project has been renamed to ProjectMonitor - http://github.com/pivotal/projectmonitor
121
star
55

tmux-config

Configuration and tools for tmux. Can be used as a Vim plugin.
Shell
121
star
56

PivotalMySQLWeb

PivotalMySQL*Web is a free Pivotal open source project, intended to handle the administration of a Pivotal MySQL Service Instance over the Web
JavaScript
120
star
57

salt-api

RETIRED: Generic, modular network access system
Python
112
star
58

atc

old - now lives in https://github.com/concourse/concourse
111
star
59

nsxansible

A set of example Ansible Modules using the above two projects as the basis
Python
110
star
60

pg2mysql

Tool for safely migrating from PostgreSQL to MySQL
Go
107
star
61

clarity-seed

This is a repository for a seed project that includes Clarity Design System's dependencies.
TypeScript
104
star
62

helm-crd

Experimental CRD controller for managing Helm releases
Go
103
star
63

fly

old - now lives in https://github.com/concourse/concourse
100
star
64

declarative-cluster-management

Declarative cluster management using constraint programming, where constraints are described using SQL.
Java
99
star
65

hillview

Big data spreadsheet
Java
99
star
66

cbapi

Carbon Black API Resources
Python
94
star
67

vmware-vcenter

VMware vCenter Module
Ruby
87
star
68

ModSecurity-envoy

ModSecurity V3 Envoy Filter
C++
86
star
69

springtrader

JavaScript
83
star
70

tic

Bit9 + Carbon Black Threat Intelligence
Python
80
star
71

runtimes

Kubeless function runtimes: https://kubeless.io/docs/runtimes/
C#
79
star
72

pyvmomi-tools

Additional community developed python packages to help you work with pyvmomi
Python
77
star
73

gpdb-sandbox-tutorials

76
star
74

salt-windows-install

Open source installer for Windows
75
star
75

vagrant-vmware-appcatalyst

Vagrant provider for VMware AppCatalyst®
Ruby
73
star
76

transport-go

Transport is a full stack, simple, fast, expandable application event bus for your applications. It provides a standardized and simple API, implemented in multiple languages, to allow any individual component inside your applications to talk to one another. This is the Golang implementation of the Transport library.
Go
72
star
77

concord

🧱⛓️ A scalable decentralized blockchain
C++
71
star
78

terraforming-gcp

use terraform, deploy yourself a pcf
HCL
71
star
79

functions

Functions Repository for Kubeless
Python
70
star
80

Pivotal-Preferences-RubyMine

This repo is deprecated. Use the "Pivotal IDE Prefs" repo instead.
70
star
81

IoT-ConnectedCar

HTML
69
star
82

ironclad

Web Application Firewall (WAF) on Kubernetes
Go
69
star
83

vsphere-automation-sdk-.net

[DEPRECATED] Please see README. C# samples, language bindings, and API reference documentation for vSphere, VMC, and NSX-T using the VMware REST API
C#
67
star
84

pymadlib

A Python wrapper for MADlib(http://madlib.net) - an open source library for scalable in-database machine learning algorithms
Jupyter Notebook
65
star
85

chaperone

Python
64
star
86

bin

old - now lives in https://github.com/concourse/concourse
64
star
87

terraforming-aws

Templates to deploy PCF and PKS
HCL
64
star
88

legacy-terraform-provider-vra7

Terraform provider for vRealize Automation 7
Go
62
star
89

tutorials

PHP
59
star
90

nsxraml

A RAML Specification Describing the NSX for vSphere API
HTML
59
star
91

vra-api-samples-for-postman

API use case samples in Postman Rest Client collection format.
58
star
92

simple-k8s-test-env

For developers building and testing Kubernetes and core Kubernetes components
Shell
58
star
93

vm-operator-api

A client API for the VM Operator project, designed to allow for integration with vSphere 7 with Kubernetes
Go
58
star
94

gcp-pcf-quickstart

Install Pivotal Cloud Foundry on Google Cloud Platform With One Command
Go
56
star
95

sunspot_matchers

RSpec matchers for testing Sunspot searches
Ruby
56
star
96

ansible-security-hardening

ansible playbooks for linux distro security hardening
56
star
97

lobot

This project has been renamed to ciborg. Please visit the ciborg page for more info.
Ruby
56
star
98

salt-pack

Salt Package Builder
Shell
55
star
99

sublime-text

Salt-related syntax highlighting and snippets for Sublime Text
JavaScript
54
star
100

pynsxv

PyNSXv is a high level python based library and CLI tool to control NSX for vSphere
Python
54
star