diff options
author | Ang Li <angli@google.com> | 2019-01-28 21:33:17 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-28 21:33:17 -0800 |
commit | 6486fbb0e93f21a3657e8a1f5660e035b51fe333 (patch) | |
tree | 3e1010992ebf56566da24a9e418da5631b6bd62d /examples/ex4_uiautomator | |
parent | a337f516cdce2882bb2a9661229f92a14d898fe3 (diff) | |
download | mobly-snippet-lib-6486fbb0e93f21a3657e8a1f5660e035b51fe333.tar.gz |
Fix examples. (#102)
* Fix ex2 and ex4 builds
* Update unsupported target SDK version.
* Update usage of deprecated API of instrumentation registry.
* Update apk path in tutorial.
Diffstat (limited to 'examples/ex4_uiautomator')
-rw-r--r-- | examples/ex4_uiautomator/build.gradle | 5 | ||||
-rw-r--r-- | examples/ex4_uiautomator/src/main/java/com/google/android/mobly/snippet/example4/UiAutomatorSnippet.java | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/examples/ex4_uiautomator/build.gradle b/examples/ex4_uiautomator/build.gradle index cd160be..9b4bbe6 100644 --- a/examples/ex4_uiautomator/build.gradle +++ b/examples/ex4_uiautomator/build.gradle @@ -1,12 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 26 + // This has to match what the appcompat dep expects. + compileSdkVersion 28 defaultConfig { applicationId "com.google.android.mobly.snippet.example4" minSdkVersion 18 - targetSdkVersion 22 + targetSdkVersion 26 versionCode 1 versionName "0.0.2" } diff --git a/examples/ex4_uiautomator/src/main/java/com/google/android/mobly/snippet/example4/UiAutomatorSnippet.java b/examples/ex4_uiautomator/src/main/java/com/google/android/mobly/snippet/example4/UiAutomatorSnippet.java index 288d1bd..9fc01b2 100644 --- a/examples/ex4_uiautomator/src/main/java/com/google/android/mobly/snippet/example4/UiAutomatorSnippet.java +++ b/examples/ex4_uiautomator/src/main/java/com/google/android/mobly/snippet/example4/UiAutomatorSnippet.java @@ -20,7 +20,8 @@ import static org.junit.Assert.assertEquals; import android.content.Context; import android.content.Intent; -import androidx.test.InstrumentationRegistry; + +import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.uiautomator.By; import androidx.test.uiautomator.UiDevice; import androidx.test.uiautomator.UiObject2; @@ -53,7 +54,7 @@ public class UiAutomatorSnippet implements Snippet { private final UiDevice mDevice; public UiAutomatorSnippet() { - mContext = InstrumentationRegistry.getContext(); + mContext = InstrumentationRegistry.getInstrumentation().getContext(); mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); } |