Fix or suppress all Lint warnings
MODIFY
analytics-samples/analytics-sample/build.gradle
analytics-samples/analytics-sample/build.gradle
@@ -3,6 +3,13 @@ apply plugin: 'com.f2prateek.javafmt'
apply from: rootProject.file('gradle/android.gradle')
+android {
+ lintOptions {
+ // Since this is just a sample app, it's ok to ignore these warnings.
+ disable 'IconMissingDensityFolder', 'GoogleAppIndexingWarning', 'AllowBackup'
+ }
+}
+
dependencies {
compile project(':analytics')
compile project(':analytics-wear')

MODIFY
analytics-samples/analytics-wear-sample/build.gradle
analytics-samples/analytics-wear-sample/build.gradle
@@ -7,10 +7,17 @@ android {
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersionWear
}
+
+ lintOptions {
+ // Since this is just a sample app, it's ok to ignore these warnings.
+ disable 'IconMissingDensityFolder', 'GoogleAppIndexingWarning', 'AllowBackup'
+ }
}
dependencies {
compile project(':analytics')
compile project(':analytics-wear')
+ // TODO: Update this dependency alongside the GPS dependency in analytics-wear.
+ //noinspection GradleDependency
compile 'com.google.android.support:wearable:1.1.0'
}

MODIFY
analytics-wear/build.gradle
analytics-wear/build.gradle
@@ -6,6 +6,8 @@ apply from: rootProject.file('gradle/android.gradle')
dependencies {
compile project(':analytics')
+ // TODO: we should update this dependency.
+ //noinspection GradleDependency
compile 'com.google.android.gms:play-services-wearable:10.2.6'
}

MODIFY
analytics/src/main/java/com/segment/analytics/Analytics.java
analytics/src/main/java/com/segment/analytics/Analytics.java
@@ -34,6 +34,7 @@ import static com.segment.analytics.internal.Utils.hasPermission;
import static com.segment.analytics.internal.Utils.isNullOrEmpty;
import android.Manifest;
+import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
@@ -108,7 +109,10 @@ public class Analytics {
@Private static final String OPT_OUT_PREFERENCE_KEY = "opt-out";
static final String WRITE_KEY_RESOURCE_IDENTIFIER = "analytics_write_key";
static final List<String> INSTANCES = new ArrayList<>(1);
+ /* This is intentional since we're only using the application context. */
+ @SuppressLint("StaticFieldLeak")
static volatile Analytics singleton = null;
+
@Private static final Properties EMPTY_PROPERTIES = new Properties();
private static final String VERSION_KEY = "version";
private static final String BUILD_KEY = "build";

MODIFY
analytics/src/main/java/com/segment/analytics/internal/Utils.java
analytics/src/main/java/com/segment/analytics/internal/Utils.java
@@ -248,7 +248,11 @@ public final class Utils {
return Collections.unmodifiableList(new ArrayList<>(list));
}
- /** Creates a unique device id. */
+ /**
+ * Creates a unique device id. Suppresses `HardwareIds` lint warnings as we don't use this ID for
+ * identifying specific users. This is also what is required by the Segment spec.
+ */
+ @SuppressLint("HardwareIds")
public static String getDeviceId(Context context) {
String androidId = getString(context.getContentResolver(), ANDROID_ID);
if (!isNullOrEmpty(androidId)
@@ -258,7 +262,7 @@ public final class Utils {
return androidId;
}
- // Serial number, guaranteed to be on all non phones in 2.3+
+ // Serial number, guaranteed to be on all non phones in 2.3+.
if (!isNullOrEmpty(Build.SERIAL)) {
return Build.SERIAL;
}

Fix or suppress all Lint warnings