diff --git a/.travis.yml b/.travis.yml
index d6c3e3d9908..bbfcc54fd5a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,7 @@
language: java
-install: mvn install clean --fail-never --quiet -DskipTests=true -Dinvoker.skip=true
-script: mvn verify
+
+install: mvn install clean -P!android --fail-never --quiet -DskipTests=true -Dinvoker.skip=true
+script: mvn verify -P!android
notifications:
email: false
diff --git a/examples/android-activity-graphs/AndroidManifest.xml b/examples/android-activity-graphs/AndroidManifest.xml
new file mode 100644
index 00000000000..adac7a87907
--- /dev/null
+++ b/examples/android-activity-graphs/AndroidManifest.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/android-activity-graphs/README.md b/examples/android-activity-graphs/README.md
new file mode 100644
index 00000000000..533d40a973e
--- /dev/null
+++ b/examples/android-activity-graphs/README.md
@@ -0,0 +1,17 @@
+Example: Android Activity Graphs
+================================
+
+Building on top of the simple Android example, this example demonstrates how it is possible to
+create child graphs for each activity which extend from the global graph.
+
+Some of the advantages of the activity scope:
+
+ * Provides the ability to inject objects which require the activity to be constructed.
+ * Allows for the use of singletons on a per-activity basis. This is a great way to manage a
+ resource that is shared by a bunch of fragments in an activity.
+ * Keeps the global object graph clear of things that can be used only be activities.
+
+While this example only shows the presence of an activity scope, you should be able to see the
+potential for other useful scopes that can be used. For example, having a dedicated object graph
+for the current user sessions is a great way to manage data that is tied to the currently logged-in
+user.
diff --git a/examples/android-activity-graphs/pom.xml b/examples/android-activity-graphs/pom.xml
new file mode 100644
index 00000000000..be3b39fed07
--- /dev/null
+++ b/examples/android-activity-graphs/pom.xml
@@ -0,0 +1,63 @@
+
+
+
+ 4.0.0
+
+
+ com.squareup.dagger.example
+ dagger-example-parent
+ 1.0-SNAPSHOT
+
+
+ android-activity-graphs
+ Examples: Android - Activity Graphs
+ apk
+
+
+
+ com.squareup.dagger
+ dagger
+ ${project.version}
+
+
+ com.squareup.dagger
+ dagger-compiler
+ ${project.version}
+ true
+
+
+
+ com.google.android
+ android
+ provided
+
+
+ com.google.android
+ support-v4
+
+
+
+
+
+
+ com.jayway.maven.plugins.android.generation2
+ android-maven-plugin
+ true
+
+
+
+
diff --git a/examples/android-activity-graphs/res/values/strings.xml b/examples/android-activity-graphs/res/values/strings.xml
new file mode 100644
index 00000000000..4247e0349b6
--- /dev/null
+++ b/examples/android-activity-graphs/res/values/strings.xml
@@ -0,0 +1,4 @@
+
+
+ Dagger Activity Graph
+
diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ActivityModule.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ActivityModule.java
new file mode 100644
index 00000000000..465d66d5d07
--- /dev/null
+++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/ActivityModule.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2013 Square, Inc.
+ *
+ * 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.example.dagger.activitygraphs;
+
+import android.content.Context;
+import com.example.dagger.activitygraphs.ui.ActivityTitleController;
+import com.example.dagger.activitygraphs.ui.HomeActivity;
+import com.example.dagger.activitygraphs.ui.HomeFragment;
+import dagger.Module;
+import dagger.Provides;
+import javax.inject.Singleton;
+
+/**
+ * This module represents objects which exist only for the scope of a single activity. We can
+ * safely create singletons using the activity instance because ths entire object graph will only
+ * ever exist inside of that activity.
+ */
+@Module(
+ injects = {
+ HomeActivity.class,
+ HomeFragment.class
+ },
+ complete = false,
+ library = true
+)
+public class ActivityModule {
+ private final DemoBaseActivity activity;
+
+ public ActivityModule(DemoBaseActivity activity) {
+ this.activity = activity;
+ }
+
+ /**
+ * Allow the activity context to be injected but require that it be annotated with
+ * {@link ForActivity @ForActivity} to explicitly differentiate it from application context.
+ */
+ @Provides @Singleton @ForActivity Context provideActivityContext() {
+ return activity;
+ }
+
+ @Provides @Singleton ActivityTitleController provideTitleController() {
+ return new ActivityTitleController(activity);
+ }
+}
diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/AndroidModule.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/AndroidModule.java
new file mode 100644
index 00000000000..78a02a4f19a
--- /dev/null
+++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/AndroidModule.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2013 Square, Inc.
+ *
+ * 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.example.dagger.activitygraphs;
+
+import android.content.Context;
+import android.location.LocationManager;
+import dagger.Module;
+import dagger.Provides;
+import javax.inject.Singleton;
+
+import static android.content.Context.LOCATION_SERVICE;
+
+/**
+ * A module for Android-specific dependencies which require a {@link Context} or
+ * {@link android.app.Application} to create.
+ */
+@Module(library = true)
+public class AndroidModule {
+ private final DemoApplication application;
+
+ public AndroidModule(DemoApplication application) {
+ this.application = application;
+ }
+
+ /**
+ * Allow the application context to be injected but require that it be annotated with
+ * {@link ForApplication @Annotation} to explicitly differentiate it from an activity context.
+ */
+ @Provides @Singleton @ForApplication Context provideApplicationContext() {
+ return application;
+ }
+
+ @Provides @Singleton LocationManager provideLocationManager() {
+ return (LocationManager) application.getSystemService(LOCATION_SERVICE);
+ }
+}
diff --git a/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplication.java b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplication.java
new file mode 100644
index 00000000000..56e1ab44058
--- /dev/null
+++ b/examples/android-activity-graphs/src/main/java/com/example/dagger/activitygraphs/DemoApplication.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2013 Square, Inc.
+ *
+ * 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.example.dagger.activitygraphs;
+
+import android.app.Application;
+import dagger.ObjectGraph;
+import java.util.Arrays;
+import java.util.List;
+
+public class DemoApplication extends Application {
+ private ObjectGraph applicationGraph;
+
+ @Override public void onCreate() {
+ super.onCreate();
+
+ applicationGraph = ObjectGraph.create(getModules().toArray());
+ }
+
+ /**
+ * A list of modules to use for the application graph. Subclasses can override this method to
+ * provide additional modules provided they call {@code super.getModules()}.
+ */
+ protected List