Skip to content

Commit ff2f09a

Browse files
Marcel Pinto Biescasschroepf
authored andcommitted
Migrate to androidX
The XmlRunListener does not work with projects using the new androidX pacakges. Run the migration tools from AS.
1 parent 4c2a01b commit ff2f09a

12 files changed

Lines changed: 41 additions & 38 deletions

File tree

android/android-xml-run-listener/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apply plugin: 'com.github.dcendents.android-maven'
44

55
// This is the library version used when deploying the artifact
66
group = "de.schroepf"
7-
version = "0.3.0"
7+
version = "0.3.1"
88

99
def siteUrl = 'https://github.com/schroepf/TestLab/tree/master/android/android-xml-run-listener'
1010
def gitUrl = 'https://github.com/schroepf/TestLab'
@@ -115,7 +115,7 @@ bintray {
115115

116116
dependencies {
117117
implementation fileTree(dir: 'libs', include: ['*.jar'])
118-
implementation ("com.android.support.test:runner:$test_runner_version") {
118+
implementation ("androidx.test:runner:$test_runner_version") {
119119
exclude module: 'support-annotations'
120120
}
121121

android/android-xml-run-listener/src/androidTest/java/de/schroepf/androidxmlrunlistener/ExampleInstrumentedTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package de.schroepf.androidxmlrunlistener;
22

3-
import android.support.test.runner.AndroidJUnit4;
3+
import androidx.test.runner.AndroidJUnit4;
44

55
import org.junit.Test;
66
import org.junit.runner.RunWith;

android/android-xml-run-listener/src/main/java/de/schroepf/androidxmlrunlistener/XmlRunListener.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import android.app.Instrumentation;
44
import android.os.Build;
5-
import android.support.test.internal.runner.listener.InstrumentationRunListener;
65
import android.util.Log;
76
import android.util.Xml;
87

@@ -17,6 +16,8 @@
1716
import java.io.IOException;
1817
import java.util.Map;
1918

19+
import androidx.test.internal.runner.listener.InstrumentationRunListener;
20+
2021
/**
2122
* An InstrumentationRunListener which writes the test results to JUnit style XML files to the
2223
* {@code /storage/emulated/0/Android/data/<package-name>/files/} directory on the device.
@@ -251,4 +252,4 @@ private void printProperty(String name, String value) throws IOException {
251252
private String sanitize(String text) {
252253
return text.replace("\0", "<\\0>");
253254
}
254-
}
255+
}

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ buildscript {
1515
}
1616

1717
ext {
18-
test_runner_version = '1.0.2'
18+
test_runner_version = '1.1.0'
1919
test_orchestrator_version = '1.0.2'
2020
android_xml_run_listener_version = '0.3.0'
2121
}

android/gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@
1515
# When configured, Gradle will run in incubating parallel mode.
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18-
# org.gradle.parallel=true
18+
# org.gradle.parallel=true
19+
android.enableJetifier=true
20+
android.useAndroidX=true

android/sampleapp/build.gradle

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ android {
1111
versionCode 1
1212
versionName "1.0"
1313

14-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1515
testInstrumentationRunnerArgument "listener", "de.schroepf.androidxmlrunlistener.XmlRunListener"
1616
}
1717

1818
testOptions {
19-
execution 'ANDROID_TEST_ORCHESTRATOR'
19+
execution 'ANDROIDX_TEST_ORCHESTRATOR'
2020
}
2121

2222
buildTypes {
@@ -33,23 +33,23 @@ android {
3333

3434
dependencies {
3535
implementation fileTree(dir: 'libs', include: ['*.jar'])
36-
implementation 'com.android.support:appcompat-v7:28.0.0'
37-
implementation 'com.android.support:design:28.0.0'
38-
implementation 'com.android.support:support-annotations:28.0.0'
36+
implementation 'androidx.appcompat:appcompat:1.0.1'
37+
implementation 'com.google.android.material:material:1.1.0-alpha01'
38+
implementation 'androidx.annotation:annotation:1.0.0'
3939

4040
testImplementation 'junit:junit:4.12'
4141

4242
// use git version
43-
// androidTestImplementation project(':android-xml-run-listener')
43+
androidTestImplementation project(':android-xml-run-listener')
4444

4545
// use published version
46-
androidTestImplementation "de.schroepf:android-xml-run-listener:$android_xml_run_listener_version"
46+
//androidTestImplementation "de.schroepf:android-xml-run-listener:$android_xml_run_listener_version"
4747

4848
// Android Testing Support Library's runner and rules
49-
androidTestImplementation ("com.android.support.test.espresso:espresso-core:3.0.1") {
49+
androidTestImplementation ("androidx.test.espresso:espresso-core:3.1.0") {
5050
exclude module: 'support-annotations'
5151
}
5252

53-
androidTestImplementation "com.android.support.test:runner:$test_runner_version"
54-
androidTestUtil "com.android.support.test:orchestrator:$test_orchestrator_version"
53+
androidTestImplementation "androidx.test:runner:$test_runner_version"
54+
androidTestUtil 'androidx.test:orchestrator:1.1.0'
5555
}

android/sampleapp/src/androidTest/java/de/schroepf/demoapp/AClass.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package de.schroepf.demoapp;
22

3-
import android.support.test.runner.AndroidJUnit4;
3+
import androidx.test.runner.AndroidJUnit4;
44

55
import org.junit.Test;
66
import org.junit.runner.RunWith;

android/sampleapp/src/androidTest/java/de/schroepf/demoapp/AnotherClass.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package de.schroepf.demoapp;
22

3-
import android.support.test.runner.AndroidJUnit4;
3+
import androidx.test.runner.AndroidJUnit4;
44

55
import org.junit.Test;
66
import org.junit.runner.RunWith;

android/sampleapp/src/androidTest/java/de/schroepf/demoapp/ExampleInstrumentedTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package de.schroepf.demoapp;
22

33
import android.content.Context;
4-
import android.support.test.InstrumentationRegistry;
5-
import android.support.test.runner.AndroidJUnit4;
4+
import androidx.test.InstrumentationRegistry;
5+
import androidx.test.runner.AndroidJUnit4;
66

77
import org.junit.Test;
88
import org.junit.runner.RunWith;
@@ -23,4 +23,4 @@ public void useAppContext() {
2323

2424
assertEquals("de.schroepf.demoapp", appContext.getPackageName());
2525
}
26-
}
26+
}

android/sampleapp/src/androidTest/java/de/schroepf/demoapp/MainActivityTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package de.schroepf.demoapp;
22

3-
import android.support.test.runner.AndroidJUnit4;
3+
import androidx.test.runner.AndroidJUnit4;
44

55
import org.junit.Ignore;
66
import org.junit.Test;
77
import org.junit.runner.RunWith;
88

9-
import static android.support.test.espresso.Espresso.onView;
10-
import static android.support.test.espresso.assertion.ViewAssertions.matches;
11-
import static android.support.test.espresso.matcher.ViewMatchers.withId;
12-
import static android.support.test.espresso.matcher.ViewMatchers.withText;
9+
import static androidx.test.espresso.Espresso.onView;
10+
import static androidx.test.espresso.assertion.ViewAssertions.matches;
11+
import static androidx.test.espresso.matcher.ViewMatchers.withId;
12+
import static androidx.test.espresso.matcher.ViewMatchers.withText;
1313
import static org.hamcrest.Matchers.is;
1414
import static org.junit.Assert.assertTrue;
1515
import static org.junit.Assert.fail;
@@ -36,4 +36,4 @@ public void testWithFailingAssumption() throws Exception {
3636
public void testFailingTest() throws Exception {
3737
fail("This is just a failing test");
3838
}
39-
}
39+
}

0 commit comments

Comments
 (0)