-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
48 lines (42 loc) · 1.66 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
lintOptions {
checkAllWarnings
disable 'OldTargetApi', 'IconXmlAndPng'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
applicationVariants.all { variant ->
if (variant.install) {
tasks.create(name: "run${variant.name.capitalize()}", type: Exec, dependsOn: variant.install) {
description "Installs the APK for ${variant.description}, and then runs the main launcher activity."
def getMainActivity = { file ->
new XmlSlurper().parse(file).application.activity.find{ it.'intent-filter'.find{ filter ->
return filter.action .find{it.'@android:name'.text() == 'android.intent.action.MAIN' } \
&& filter.category.find{it.'@android:name'.text() == 'android.intent.category.LAUNCHER'}
}}.'@android:name'
}
doFirst {
def activityClass = getMainActivity(variant.outputs.processManifest.manifestOutputFile)
commandLine android.adbExe, 'shell', 'am', 'start', '-n', "${variant.applicationId}/${activityClass}"
}
}
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.github.bumptech.glide:glide:3.3.1'
compile 'com.android.support:support-v4:20.0.0'
}
tasks.withType(JavaCompile) {
if (!name.contains('Test')) {
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
}
}