Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with androidTest in Android Studio 3.0 Canary 4 - assume it's not ThreeTenABP? #54

Closed
alteredworlds opened this issue Jun 28, 2017 · 3 comments

Comments

@alteredworlds
Copy link

I assume this is a problem with Android Studio 3.0 Canary 4 / gradle:3.0.0-alpha4 rather than ThreeTenABP, in which case sorry for wasting your time here, but wanted to ask just in case I'm doing something wrong.

I see 'org.threeten.bp.zone.ZoneRulesException: No time-zone data files registered' when trying to run an androidTest, even though I specify:

// JSR-310 java.time.* backport
 implementation "com.jakewharton.threetenabp:threetenabp:1.0.5"
 // For testing, require version containing assets in Android-inefficient manner
 // see: https://github.com/JakeWharton/ThreeTenABP/issues/14
 androidTestImplementation("org.threeten:threetenbp:1.3.3") {
     exclude group: 'com.jakewharton.threetenabp', module: 'threetenabp'
 }

https://github.com/alteredworlds/androidtestcompileexclude

@alteredworlds
Copy link
Author

alteredworlds commented Jul 7, 2017

see: https://issuetracker.google.com/issues/63748587
Google's response:

What you need to do is do this at the level of the variant-specific resolved configuration instead, which are debugAndroidTestCompileClasspath/debugAndroidTestRuntimeClasspath. You can get access to these via the variant apis:

android.testVariants.all { variant ->
        variant.getCompileConfiguration().exclude group: 'com.jakewharton.threetenabp', module: 'threetenabp'
        variant.getRuntimeConfiguration().exclude group: 'com.jakewharton.threetenabp', module: 'threetenabp'
}

This approach does remove any mention of threetenabp from the output of both of:

./gradlew app:dependencies --configuration debugAndroidTestCompileClasspath 
./gradlew app:dependencies --configuration debugAndroidTestRuntimeClasspath

But unfortunately I still see the same error as before when running androidTest(s):

org.threeten.bp.zone.ZoneRulesException: No time-zone data files registered
at org.threeten.bp.zone.ZoneRulesProvider.getProvider(ZoneRulesProvider.java:176)
at org.threeten.bp.zone.ZoneRulesProvider.getRules(ZoneRulesProvider.java:133)
at org.threeten.bp.ZoneRegion.ofId(ZoneRegion.java:143)
at org.threeten.bp.ZoneId.of(ZoneId.java:357)
at org.threeten.bp.ZoneId.of(ZoneId.java:285)
at org.threeten.bp.ZoneId.systemDefault(ZoneId.java:244)
at org.threeten.bp.Clock.systemDefaultZone(Clock.java:137)
at org.threeten.bp.LocalDate.now(LocalDate.java:165)
at com.example.androidtestcompileexclude.ExampleInstrumentedTest.testDate(ExampleInstrumentedTest.java:44)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932)

I've included the suggested fix in my test project (above) on branch studio3, still demonstrates this problem. Anyone got any ideas, please? What am I missing?

@alteredworlds
Copy link
Author

Fixed in Android Studio 3.0 Beta 2 with
build.gradle: classpath 'com.android.tools.build:gradle:3.0.0-beta3'
gradle-wrapper.properties distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip

@JakeWharton
Copy link
Owner

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants