diff options
Diffstat (limited to 'examples')
11 files changed, 71 insertions, 65 deletions
diff --git a/examples/ex1_standalone_app/build.gradle b/examples/ex1_standalone_app/build.gradle index 29e61b3..1825c7e 100644 --- a/examples/ex1_standalone_app/build.gradle +++ b/examples/ex1_standalone_app/build.gradle @@ -1,27 +1,27 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 24 - buildToolsVersion '25.0.0' + compileSdkVersion 26 defaultConfig { applicationId "com.google.android.mobly.snippet.example1" - minSdkVersion 11 - targetSdkVersion 24 + minSdkVersion 15 + targetSdkVersion 22 versionCode 1 versionName "0.0.1" } lintOptions { - abortOnError true + abortOnError false checkAllWarnings true warningsAsErrors true + disable 'HardwareIds','MissingApplicationIcon','GoogleAppIndexingWarning','InvalidPackage','OldTargetApi' } } dependencies { - // The 'compile project' dep is to compile against the snippet lib source in + // The 'implementation project' dep is to compile against the snippet lib source in // this repo. For your own snippets, you'll want to use the regular - // 'compile' dep instead: - //compile 'com.google.android.mobly:mobly-snippet-lib:1.2.0' - compile project(':mobly-snippet-lib') + // 'implementation' dep instead: + //implementation 'com.google.android.mobly:mobly-snippet-lib:1.3.0' + implementation project(':mobly-snippet-lib') } diff --git a/examples/ex1_standalone_app/src/main/AndroidManifest.xml b/examples/ex1_standalone_app/src/main/AndroidManifest.xml index e1b5cf1..90ebdea 100644 --- a/examples/ex1_standalone_app/src/main/AndroidManifest.xml +++ b/examples/ex1_standalone_app/src/main/AndroidManifest.xml @@ -3,7 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.android.mobly.snippet.example1"> - <application> + <application android:allowBackup="false"> <!-- Required: list of all classes with @Rpc methods. --> <meta-data android:name="mobly-snippets" diff --git a/examples/ex2_espresso/build.gradle b/examples/ex2_espresso/build.gradle index a8c0c31..2757808 100644 --- a/examples/ex2_espresso/build.gradle +++ b/examples/ex2_espresso/build.gradle @@ -1,39 +1,46 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 24 - buildToolsVersion '25.0.0' + compileSdkVersion 26 + flavorDimensions "examples" defaultConfig { applicationId "com.google.android.mobly.snippet.example2" - minSdkVersion 11 - targetSdkVersion 24 + minSdkVersion 15 + targetSdkVersion 22 versionCode 1 versionName "0.0.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } productFlavors { - main {} - snippet {} + main { + dimension "examples" + } + snippet { + dimension "examples" + } } + lintOptions { abortOnError true checkAllWarnings true warningsAsErrors true + disable 'HardcodedText', 'UnusedIds','MissingApplicationIcon','GoogleAppIndexingWarning','InvalidPackage','OldTargetApi' } } dependencies { - compile 'com.android.support:appcompat-v7:24.2.1' + implementation 'com.android.support:appcompat-v7:26.1.0' + implementation 'com.android.support.test:runner:1.0.1' // The androidTest package is not for snippet support; it shows an example // of an instrumentation test coexisting with a snippet in the same // codebase. - androidTestCompile 'com.android.support:support-annotations:24.2.1' - androidTestCompile 'com.android.support.test:runner:0.5' - androidTestCompile 'com.android.support.test:rules:0.5' - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + androidTestImplementation 'com.android.support:support-annotations:26.1.0' + androidTestImplementation 'com.android.support.test:runner:1.0.1' + androidTestImplementation 'com.android.support.test:rules:1.0.1' + androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', { exclude group: 'com.android.support', module: 'support-annotations' }) @@ -41,8 +48,8 @@ dependencies { // source in this repo. For your own snippets, you'll want to use the // regular 'snippetCompile' dep instead: //snippetCompile 'com.google.android.mobly:mobly-snippet-lib:1.2.0' - snippetCompile project(':mobly-snippet-lib') + snippetImplementation project(':mobly-snippet-lib') - snippetCompile 'com.android.support.test.espresso:espresso-core:2.2.2' - snippetCompile 'com.android.support:support-annotations:24.2.1' + snippetImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + snippetImplementation 'com.android.support:support-annotations:26.1.0' } diff --git a/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java b/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java index 40311c3..940418a 100644 --- a/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java +++ b/examples/ex2_espresso/src/main/java/com/google/android/mobly/snippet/example2/MainActivity.java @@ -16,6 +16,7 @@ package com.google.android.mobly.snippet.example2; +import java.util.Locale; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; @@ -42,7 +43,7 @@ public class MainActivity extends AppCompatActivity { @Override public void onClick(View v) { mNumPressed++; - mTextView.setText("Button pressed " + mNumPressed + " times"); + mTextView.setText(String.format(Locale.ROOT, "Button pressed %d times.", mNumPressed)); } }); } diff --git a/examples/ex2_espresso/src/main/res/layout/activity_main.xml b/examples/ex2_espresso/src/main/res/layout/activity_main.xml index 013d6a4..e190302 100644 --- a/examples/ex2_espresso/src/main/res/layout/activity_main.xml +++ b/examples/ex2_espresso/src/main/res/layout/activity_main.xml @@ -8,20 +8,16 @@ android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.google.android.mobly.snippet.example2.MainActivity"> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - <TextView - android:id="@+id/main_text_view" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:text="Hello World!" /> - <Button - android:id="@+id/main_button" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="Push the button!" /> - </LinearLayout> +<TextView + android:id="@+id/main_text_view" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:text="Hello World!" /> + +<Button + android:id="@+id/main_button" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Push the button!" /> </RelativeLayout> diff --git a/examples/ex3_async_event/build.gradle b/examples/ex3_async_event/build.gradle index 2fcb8f9..4fb63f9 100644 --- a/examples/ex3_async_event/build.gradle +++ b/examples/ex3_async_event/build.gradle @@ -1,20 +1,20 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 24 - buildToolsVersion '25.0.0' + compileSdkVersion 26 defaultConfig { applicationId "com.google.android.mobly.snippet.example3" - minSdkVersion 11 - targetSdkVersion 24 + minSdkVersion 15 + targetSdkVersion 22 versionCode 1 versionName "0.0.1" } lintOptions { - abortOnError true + abortOnError false checkAllWarnings true warningsAsErrors true + disable 'HardwareIds','MissingApplicationIcon','GoogleAppIndexingWarning','InvalidPackage','OldTargetApi' } } @@ -22,5 +22,5 @@ dependencies { // The 'compile project' dep is to compile against the snippet lib source in // this repo. For your own snippets, you'll want to use the regular 'compile' dep instead: // compile 'com.google.android.mobly:mobly-snippet-lib:1.2.0' - compile project(':mobly-snippet-lib') + implementation project(':mobly-snippet-lib') } diff --git a/examples/ex3_async_event/src/main/AndroidManifest.xml b/examples/ex3_async_event/src/main/AndroidManifest.xml index 8e2887c..dcc724b 100644 --- a/examples/ex3_async_event/src/main/AndroidManifest.xml +++ b/examples/ex3_async_event/src/main/AndroidManifest.xml @@ -3,7 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.android.mobly.snippet.example3"> - <application> + <application android:allowBackup="false"> <meta-data android:name="mobly-snippets" android:value="com.google.android.mobly.snippet.example3.ExampleAsyncSnippet" /> diff --git a/examples/ex4_uiautomator/build.gradle b/examples/ex4_uiautomator/build.gradle index 8298d9b..1d89fdf 100644 --- a/examples/ex4_uiautomator/build.gradle +++ b/examples/ex4_uiautomator/build.gradle @@ -1,20 +1,20 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 24 - buildToolsVersion '25.0.0' + compileSdkVersion 26 defaultConfig { applicationId "com.google.android.mobly.snippet.example4" minSdkVersion 18 - targetSdkVersion 24 + targetSdkVersion 22 versionCode 1 - versionName "0.0.1" + versionName "0.0.2" } lintOptions { - abortOnError true + abortOnError false checkAllWarnings true warningsAsErrors true + disable 'HardwareIds','MissingApplicationIcon','GoogleAppIndexingWarning','InvalidPackage','OldTargetApi' } } @@ -23,8 +23,9 @@ dependencies { // this repo. For your own snippets, you'll want to use the regular // 'compile' dep instead: //compile 'com.google.android.mobly:mobly-snippet-lib:1.2.0' - compile project(':mobly-snippet-lib') - - compile 'com.android.support:appcompat-v7:24.2.1' - compile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2' + implementation project(':mobly-snippet-lib') + implementation 'junit:junit:4.12' + implementation 'com.android.support.test:runner:1.0.1' + implementation 'com.android.support:appcompat-v7:26.1.0' + implementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3' } diff --git a/examples/ex4_uiautomator/src/main/AndroidManifest.xml b/examples/ex4_uiautomator/src/main/AndroidManifest.xml index 4644ff0..89d5276 100644 --- a/examples/ex4_uiautomator/src/main/AndroidManifest.xml +++ b/examples/ex4_uiautomator/src/main/AndroidManifest.xml @@ -3,7 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.android.mobly.snippet.example4"> - <application> + <application android:allowBackup="false"> <meta-data android:name="mobly-snippets" android:value="com.google.android.mobly.snippet.example4.UiAutomatorSnippet" /> diff --git a/examples/ex5_schedule_rpc/build.gradle b/examples/ex5_schedule_rpc/build.gradle index 8c25983..53cd5a0 100644 --- a/examples/ex5_schedule_rpc/build.gradle +++ b/examples/ex5_schedule_rpc/build.gradle @@ -1,20 +1,20 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 24 - buildToolsVersion '25.0.0' + compileSdkVersion 26 defaultConfig { applicationId "com.google.android.mobly.snippet.example5" - minSdkVersion 11 - targetSdkVersion 24 + minSdkVersion 15 + targetSdkVersion 22 versionCode 1 versionName "0.0.1" } lintOptions { - abortOnError true + abortOnError false checkAllWarnings true warningsAsErrors true + disable 'HardwareIds','MissingApplicationIcon','GoogleAppIndexingWarning','InvalidPackage','OldTargetApi' } } @@ -22,5 +22,6 @@ dependencies { // The 'compile project' dep is to compile against the snippet lib source in // this repo. For your own snippets, you'll want to use the regular 'compile' dep instead: // compile 'com.google.android.mobly:mobly-snippet-lib:1.1.0' - compile project(':mobly-snippet-lib') + implementation project(':mobly-snippet-lib') + implementation 'com.android.support.test:runner:1.0.1' } diff --git a/examples/ex5_schedule_rpc/src/main/AndroidManifest.xml b/examples/ex5_schedule_rpc/src/main/AndroidManifest.xml index cef56e6..9a3271c 100644 --- a/examples/ex5_schedule_rpc/src/main/AndroidManifest.xml +++ b/examples/ex5_schedule_rpc/src/main/AndroidManifest.xml @@ -3,7 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.android.mobly.snippet.example5"> - <application> + <application android:allowBackup="false"> <meta-data android:name="mobly-snippets" android:value="com.google.android.mobly.snippet.example5.ExampleScheduleRpcSnippet" /> |