forked from realm/realm-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
67 lines (60 loc) · 2.15 KB
/
build.gradle
File metadata and controls
67 lines (60 loc) · 2.15 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
apply plugin: 'com.android.application'
apply plugin: 'android-command'
apply plugin: 'realm-android'
// Credit: http://jeremie-martinez.com/2015/05/05/inject-host-gradle/
def getIP() {
InetAddress result = null;
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
Enumeration<InetAddress> addresses = interfaces.nextElement().getInetAddresses();
while (addresses.hasMoreElements()) {
InetAddress address = addresses.nextElement();
if (!address.isLoopbackAddress()) {
if (address.isSiteLocalAddress()) {
return address.getHostAddress();
} else if (result == null) {
result = address;
}
}
}
}
return (result != null ? result : InetAddress.getLocalHost()).getHostAddress();
}
android {
compileSdkVersion rootProject.sdkVersion
buildToolsVersion rootProject.buildTools
defaultConfig {
applicationId 'io.realm.examples.objectserver'
targetSdkVersion rootProject.sdkVersion
minSdkVersion 15
versionCode 1
versionName "1.0"
}
buildTypes {
// This will automatically try to detect the IP address of the machine
// building the example. It is assumed that this machine is also running
// the Object Server. If not, replace 'host' with the IP of the machine
// hosting the server. In some cases the wrong IP address will also
// be detected. In that case also insert the IP address manually.
def host = getIP()
debug {
buildConfigField "String", "OBJECT_SERVER_IP", "\"${host}\""
}
release {
minifyEnabled false
buildConfigField "String", "OBJECT_SERVER_IP", "\"${host}\""
}
}
command {
events 2000
}
}
realm {
syncEnabled = true
}
dependencies {
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}