Add sample Android app (#76)

Fixes #59
diff --git a/.travis.yml b/.travis.yml
index d5b749f..7a0eeaa 100755
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,20 @@
-language: java
+language: android
 
 jdk:
   - oraclejdk8
 
+android:
+  components:
+    - tools
+    - platform-tools
+    - build-tools-27.0.2
+    - android-27    
+    - extra-google-m2repository
+    - extra-android-m2repository
+
+before_install:
+  - yes | sdkmanager "platforms;android-27"
+
 script:
   - ./gradlew verGJF build
 
diff --git a/build.gradle b/build.gradle
index 498ae4d..f149351 100644
--- a/build.gradle
+++ b/build.gradle
@@ -38,6 +38,7 @@
             url "https://raw.githubusercontent.com/msridhar/checker-framework/repository/"
         }
         jcenter()
+        google()
     }
 
 }
diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle
index 3b2dd88..6904a5a 100755
--- a/gradle/dependencies.gradle
+++ b/gradle/dependencies.gradle
@@ -18,6 +18,7 @@
     checkerFramework       : "2.1.14",
     checkerFrameworkNAFork : "2.1.14.1-nullaway",
     errorProne             : "2.1.1",
+    support                : "27.0.2"
 ]
 
 def apt = [
@@ -35,6 +36,22 @@
     gradleErrorPronePlugin  : "net.ltgt.gradle:gradle-errorprone-plugin:0.0.8",
     guava                   : "com.google.guava:guava:21.0",
     jsr305Annotations       : "com.google.code.findbugs:jsr305:3.0.2",
+
+    // android stuff
+    buildToolsVersion: "27.0.2",
+    compileSdkVersion: 27,
+    ci: "true" == System.getenv("CI"),
+    minSdkVersion: 16,
+    targetSdkVersion: 27,
+
+    gradlePlugins: [
+        android: "com.android.tools.build:gradle:3.0.1",
+    ]
+
+]
+
+def support = [
+    appcompat   : "com.android.support:appcompat-v7:${versions.support}"
 ]
 
 def test = [
@@ -47,6 +64,7 @@
 ext.deps = [
     "apt": apt,
     "build": build,
+    "support": support,
     "test": test,
     "versions": versions
 ]
diff --git a/sample-app/build.gradle b/sample-app/build.gradle
new file mode 100644
index 0000000..ba9b7c0
--- /dev/null
+++ b/sample-app/build.gradle
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2017. Uber Technologies
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+buildscript {
+    repositories {
+      // for android gradle plugin 3
+      google()
+    }
+    dependencies {
+        classpath deps.build.gradlePlugins.android
+        classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.13"
+    }
+}
+
+apply plugin: 'com.android.application'
+apply plugin: 'net.ltgt.errorprone'
+
+android {
+    compileSdkVersion deps.build.compileSdkVersion
+    buildToolsVersion deps.build.buildToolsVersion
+
+    defaultConfig {
+        applicationId "com.uber.myapplication"
+        minSdkVersion deps.build.minSdkVersion
+        targetSdkVersion deps.build.targetSdkVersion
+        versionCode 1
+        versionName "1.0"
+    }
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_7
+        targetCompatibility JavaVersion.VERSION_1_7
+    }
+
+    lintOptions {
+        abortOnError false
+    }
+}
+
+dependencies {
+    compile deps.support.appcompat
+
+    testCompile deps.test.junit
+
+    annotationProcessor project(path: ":nullaway", configuration: "shadow")
+
+    annotationProcessor project(path: ":sample-library-model")
+
+    errorprone "com.google.errorprone:error_prone_core:2.1.3"
+}
+
+tasks.withType(JavaCompile) {
+  // remove the if condition if you want to run NullAway on test code
+  if (!name.toLowerCase().contains("test")) {
+    options.compilerArgs += ["-Xep:NullAway:ERROR", "-XepOpt:NullAway:AnnotatedPackages=com.uber"]
+  }
+}
+
diff --git a/sample-app/src/main/AndroidManifest.xml b/sample-app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..49c4290
--- /dev/null
+++ b/sample-app/src/main/AndroidManifest.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.uber.myapplication">
+
+    <application
+        android:allowBackup="false"
+        android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
+        android:roundIcon="@mipmap/ic_launcher_round"
+        android:supportsRtl="true"
+        android:theme="@style/AppTheme">
+        <activity android:name=".MainActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+
+</manifest>
\ No newline at end of file
diff --git a/sample-app/src/main/java/com/uber/myapplication/MainActivity.java b/sample-app/src/main/java/com/uber/myapplication/MainActivity.java
new file mode 100644
index 0000000..9b35f03
--- /dev/null
+++ b/sample-app/src/main/java/com/uber/myapplication/MainActivity.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017. Uber Technologies
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.uber.myapplication;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v7.app.AppCompatActivity;
+import org.utilities.StringUtils;
+
+/** Sample activity. */
+public class MainActivity extends AppCompatActivity {
+
+  @Override
+  protected void onCreate(Bundle savedInstanceState) {
+    super.onCreate(savedInstanceState);
+    setContentView(R.layout.activity_main);
+    // uncomment to show that NullAway is actually running
+    // Object x = null;
+    // x.hashCode();
+  }
+
+  static int checkModel(@Nullable String s) {
+    if (!StringUtils.isEmptyOrNull(s)) {
+      return s.hashCode();
+    }
+    return 0;
+  }
+}
diff --git a/sample-app/src/main/java/org/utilities/StringUtils.java b/sample-app/src/main/java/org/utilities/StringUtils.java
new file mode 100644
index 0000000..1a20407
--- /dev/null
+++ b/sample-app/src/main/java/org/utilities/StringUtils.java
@@ -0,0 +1,10 @@
+package org.utilities;
+
+import android.support.annotation.Nullable;
+
+public class StringUtils {
+
+  public static boolean isEmptyOrNull(@Nullable final CharSequence value) {
+    return value == null || value.length() == 0;
+  }
+}
diff --git a/sample-app/src/main/res/layout/activity_main.xml b/sample-app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..9a3bfc9
--- /dev/null
+++ b/sample-app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/activity_main"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingBottom="@dimen/activity_vertical_margin"
+    android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    tools:context="com.uber.myapplication.MainActivity">
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Hello World!" />
+</RelativeLayout>
diff --git a/sample-app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sample-app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
--- /dev/null
+++ b/sample-app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/sample-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/sample-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9bec2e6
--- /dev/null
+++ b/sample-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/sample-app/src/main/res/values/colors.xml b/sample-app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/sample-app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="colorPrimary">#3F51B5</color>
+    <color name="colorPrimaryDark">#303F9F</color>
+    <color name="colorAccent">#FF4081</color>
+</resources>
diff --git a/sample-app/src/main/res/values/dimens.xml b/sample-app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..47c8224
--- /dev/null
+++ b/sample-app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+<resources>
+    <!-- Default screen margins, per the Android Design guidelines. -->
+    <dimen name="activity_horizontal_margin">16dp</dimen>
+    <dimen name="activity_vertical_margin">16dp</dimen>
+</resources>
diff --git a/sample-app/src/main/res/values/strings.xml b/sample-app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..dff2b1a
--- /dev/null
+++ b/sample-app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+<resources>
+    <string name="app_name">NullAway Sample</string>
+</resources>
diff --git a/sample-app/src/main/res/values/styles.xml b/sample-app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..5885930
--- /dev/null
+++ b/sample-app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+<resources>
+
+    <!-- Base application theme. -->
+    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+        <!-- Customize your theme here. -->
+        <item name="colorPrimary">@color/colorPrimary</item>
+        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+        <item name="colorAccent">@color/colorAccent</item>
+    </style>
+
+</resources>
diff --git a/settings.gradle b/settings.gradle
index 5b05d23..336028d 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,3 +1,4 @@
 include ':nullaway'
 include ':sample-library-model'
 include ':sample'
+include ':sample-app'