Skip to content

Commit 7ebfdae

Browse files
committed
Merge pull request dam5s#2 from joerodriguez/master
Simplify build and use Dagger2 for DI
2 parents 46f05d1 + ea77da0 commit 7ebfdae

25 files changed

+201
-302
lines changed

Diff for: .DS_Store

6 KB
Binary file not shown.

Diff for: README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# Android Example Kotlin
2-
An example of basic Android application setup using Kotlin. It can run Robolectric and Espresso tests.
2+
An example of basic Android application setup using Kotlin, including Robolectric tests.
33

44
This is an example built from the three following sources
55

66
* [Deckard Gradle](https://github.com/robolectric/deckard-gradle) (from the Robolectric team)
7-
demonstrates the base structure for running Robolectric tests and Espresso tests through gradle.
7+
demonstrates the base structure for running Robolectric tests through gradle.
88
* [tests-app-robolectric-junit](https://github.com/blundell/tests-app-robolectric-junit) (by Paul Blundell)
99
demonstrates how to use a components based structure in order to make Robolectric tests well supported by Android Studio.
1010
* [Kotlin Android Tutorial](http://kotlinlang.org/docs/tutorials/kotlin-android.html)
1111
On how to convert the existing Java sctructure to Kotlin.
1212

1313
I haven't done any extra work on making the code nicer using Kotlin.
1414
This project is just a nice minimal starter for any android project using Kotlin and Robolectric.
15+
16+
17+
## Setup
18+
19+
Use Android Studio

Diff for: application/build.gradle

-35
This file was deleted.

Diff for: application/src/androidTest/kotlin/ExampleEspressoTest.kt

-23
This file was deleted.

Diff for: application/src/main/kotlin/ExampleApplication.kt

-5
This file was deleted.

Diff for: application/src/main/kotlin/ServiceLocator.kt

-9
This file was deleted.

Diff for: application/src/main/kotlin/extensions/ButterKnife.kt

-89
This file was deleted.

Diff for: application/src/main/kotlin/login/LoginActivity.kt

-32
This file was deleted.

Diff for: application/src/main/kotlin/tasks/Promise.kt

-5
This file was deleted.

Diff for: build.gradle

+51-8
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,65 @@
1+
apply plugin: 'com.android.application'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'kotlin-android-extensions'
4+
5+
repositories {
6+
mavenCentral()
7+
}
8+
9+
android {
10+
compileSdkVersion 21
11+
buildToolsVersion "23.0.3"
12+
13+
defaultConfig {
14+
minSdkVersion 16
15+
targetSdkVersion 21
16+
versionCode 2
17+
versionName "1.0.0-SNAPSHOT"
18+
applicationId "com.example"
19+
}
20+
}
21+
22+
kapt {
23+
generateStubs = true
24+
}
25+
26+
dependencies {
27+
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
28+
29+
compile 'com.android.support:support-v4:21.0.3'
30+
compile 'com.android.support:recyclerview-v7:21.0.3'
31+
32+
compile 'com.google.dagger:dagger:2.0'
33+
kapt 'com.google.dagger:dagger-compiler:2.0'
34+
provided 'org.glassfish:javax.annotation:10.0-b28'
35+
36+
37+
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
38+
testCompile "junit:junit:4.12"
39+
testCompile "org.hamcrest:hamcrest-core:1.1"
40+
testCompile "org.hamcrest:hamcrest-library:1.1"
41+
testCompile "org.hamcrest:hamcrest-integration:1.1"
42+
testCompile "org.robolectric:robolectric:3.0"
43+
testCompile "org.mockito:mockito-core:1.9.5"
44+
}
45+
146
buildscript {
2-
ext.kotlin_version = '0.11.91.4'
47+
ext.kotlin_version = '1.0.1-1'
348

449
repositories {
550
mavenLocal()
651
mavenCentral()
752
maven {
853
url "https://repo1.maven.org/maven2"
954
}
55+
maven {
56+
url 'http://oss.sonatype.org/content/repositories/snapshots'
57+
}
1058
}
1159

1260
dependencies {
13-
classpath 'com.android.tools.build:gradle:1.1.3'
61+
classpath 'com.android.tools.build:gradle:1.5.0'
62+
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
1463
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1564
}
1665
}
17-
18-
subprojects {
19-
repositories {
20-
mavenCentral()
21-
}
22-
}

Diff for: local.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
# Location of the SDK. This is only used by Gradle.
88
# For customization when using a Version Control System, please read the
99
# header note.
10-
#Sat May 09 07:27:13 MDT 2015
11-
sdk.dir=/Users/dam5s/Library/Android/sdk
10+
#Thu Mar 24 14:24:26 MDT 2016
11+
sdk.dir=/Users/josephrodriguez/Library/Android/sdk

Diff for: robolectric-tests/build.gradle

-47
This file was deleted.

Diff for: settings.gradle

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
11
rootProject.name = "android-example"
2-
3-
include "application"
4-
include "robolectric-tests"

Diff for: application/src/main/AndroidManifest.xml renamed to src/main/AndroidManifest.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
package="com.example">
44

55
<application
6-
android:name=".ExampleApplication"
6+
android:name="com.example.ExampleApplication"
77
android:allowBackup="true">
8-
<activity android:name="com.example.login.LoginActivity" android:screenOrientation="portrait">
8+
<activity android:name=".login.LoginActivity" android:screenOrientation="portrait">
99
<intent-filter>
1010
<action android:name="android.intent.action.MAIN"/>
1111
<category android:name="android.intent.category.LAUNCHER"/>

0 commit comments

Comments
 (0)