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

OkHttp 3.1.2, Retrofit 2.0.0-beta4, Stetho 1.3.0 #88

Merged
merged 1 commit into from
Feb 15, 2016

Conversation

artem-zinnatullin
Copy link
Owner

Closes #87, closes #70.

Required quite a lot changes because both OkHttp and Retrofit now in new packages w/ version number + OkHttp is now immutable but at the same time we have 2 interceptors for debug only build, so, yeah.

@vanniktech PTAL :)

@artem-zinnatullin artem-zinnatullin self-assigned this Feb 7, 2016
@artem-zinnatullin artem-zinnatullin added this to the v1.0 milestone Feb 7, 2016
@artem-zinnatullin
Copy link
Owner Author

Hm, looks like Robolectric has some problems with OkHttp 3.1.0

com.artemzin.qualitymatters.ui.fragments.ItemsFragmentTest > onTryAgainButtonClick_shouldRequestDataFromPresenter STANDARD_ERROR
    java.lang.IllegalStateException: Unable to extract the trust manager on okhttp3.internal.Platform$Android@483cacc0, sslSocketFactory is class sun.security.ssl.SSLSocketFactoryImpl
        at okhttp3.OkHttpClient.<init>(OkHttpClient.java:187)
        at okhttp3.OkHttpClient.<init>(OkHttpClient.java:60)
        at okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:719)
        at com.artemzin.qualitymatters.network.NetworkModule.provideOkHttpClient(NetworkModule.java:34)
        at com.artemzin.qualitymatters.network.NetworkModule_ProvideOkHttpClientFactory.get(NetworkModule_ProvideOkHttpClientFactory.java:27)
        at com.artemzin.qualitymatters.network.NetworkModule_ProvideOkHttpClientFactory.get(NetworkModule_ProvideOkHttpClientFactory.java:10)
        at dagger.internal.ScopedProvider.get(ScopedProvider.java:46)
        at com.artemzin.qualitymatters.developer_settings.DeveloperSettingsModule_ProvideDeveloperSettingsModelImplFactory.get(DeveloperSettingsModule_ProvideDeveloperSettingsModelImplFactory.java:40)
        at com.artemzin.qualitymatters.developer_settings.DeveloperSettingsModule_ProvideDeveloperSettingsModelImplFactory.get(DeveloperSettingsModule_ProvideDeveloperSettingsModelImplFactory.java:11)
        at dagger.internal.ScopedProvider.get(ScopedProvider.java:46)
        at com.artemzin.qualitymatters.developer_settings.DeveloperSettingsModule_ProvideDeveloperSettingsModelFactory.get(DeveloperSettingsModule_ProvideDeveloperSettingsModelFactory.java:21)
        at com.artemzin.qualitymatters.developer_settings.DeveloperSettingsModule_ProvideDeveloperSettingsModelFactory.get(DeveloperSettingsModule_ProvideDeveloperSettingsModelFactory.java:7)
        at dagger.internal.DoubleCheckLazy.get(DoubleCheckLazy.java:49)
        at com.artemzin.qualitymatters.QualityMattersApp.onCreate(QualityMattersApp.java:51)
        at org.robolectric.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:140)
        at org.robolectric.RobolectricTestRunner.setUpApplicationState(RobolectricTestRunner.java:433)
        at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:240)
        at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:188)
        at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:54)
        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.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:152)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:105)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:56)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:64)
        at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:50)
        at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
        at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:106)
        at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

com.artemzin.qualitymatters.ui.fragments.ItemsFragmentTest > onTryAgainButtonClick_shouldRequestDataFromPresenter FAILED
    java.lang.RuntimeException: java.lang.IllegalStateException: Unable to extract the trust manager on okhttp3.internal.Platform$Android@483cacc0, sslSocketFactory is class sun.security.ssl.SSLSocketFactoryImpl

        Caused by:
        java.lang.IllegalStateException: Unable to extract the trust manager on okhttp3.internal.Platform$Android@483cacc0, sslSocketFactory is class sun.security.ssl.SSLSocketFactoryImpl

Will investigate later.


return builder.build().create(QualityMattersRestApi.class);
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.validateEagerly(BuildConfig.DEBUG) // Fail early: check Retrofit configuration at creation time in Debug build.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about doing this in a unit test instead?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! The only downside of this is that it'll require providing Retrofit.Builder, but seems like worth it

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #92 for this, will go into separate PR

@vanniktech
Copy link
Contributor

@artem-zinnatullin looks good on my side. 👍 I have only the one suggestion regarding the @Named in dagger.

Since I haven't upgraded OkHttp in my projects to 3 yet, I haven't experienced this Robolectric issue.

@artem-zinnatullin
Copy link
Owner Author

Found the issue with OkHttp square/okhttp#2323, 3.0.1 doesn't have such problem.

// Another thing is that many classes in OkHttp are now final… uh

@artem-zinnatullin
Copy link
Owner Author

Duck, in 3.1.0 OkHttpClient now back non-final, dependency trap 😿

@artem-zinnatullin
Copy link
Owner Author

I don't want to use PowerMock or other solutions, so, I'd wait for 3.1.1, should be released soon.

@artem-zinnatullin
Copy link
Owner Author

Unfortunately, OkHttp 3.1.1 didn't fix that, will continue monitoring the situation.

@vanniktech
Copy link
Contributor

Hmm that's a bummer. Let's hope 3.1.2 will fix this.

@vanniktech
Copy link
Contributor

@artem-zinnatullin I think 3.1.2 fixed the robolectric issue.

@artem-zinnatullin
Copy link
Owner Author

Yup, will try soon

On Thu, 11 Feb 2016, 07:28 Niklas Baudy [email protected] wrote:

@artem-zinnatullin https://github.com/artem-zinnatullin I think 3.1.2
fixed the robolectric issue.


Reply to this email directly or view it on GitHub
#88 (comment)
.

@artem_zin

@artem-zinnatullin artem-zinnatullin force-pushed the okhttp-3-retrofit-new-beta branch from 1c973e6 to 0ae886f Compare February 11, 2016 21:15
@artem-zinnatullin artem-zinnatullin changed the title OkHttp 3.1.0, Retrofit 2.0.0-beta4, Stetho 1.3.0 OkHttp 3.1.2, Retrofit 2.0.0-beta4, Stetho 1.3.0 Feb 11, 2016
@artem-zinnatullin artem-zinnatullin force-pushed the okhttp-3-retrofit-new-beta branch from 0ae886f to 40e9687 Compare February 12, 2016 07:32
@artem-zinnatullin artem-zinnatullin force-pushed the okhttp-3-retrofit-new-beta branch 3 times, most recently from fb39e7f to aa8d08b Compare February 15, 2016 04:21
@artem-zinnatullin
Copy link
Owner Author

@vanniktech fixed comments!

@vanniktech
Copy link
Contributor

Nice 👍

artem-zinnatullin added a commit that referenced this pull request Feb 15, 2016
OkHttp 3.1.2, Retrofit 2.0.0-beta4, Stetho 1.3.0
@artem-zinnatullin artem-zinnatullin merged commit c34a76e into master Feb 15, 2016
@artem-zinnatullin artem-zinnatullin deleted the okhttp-3-retrofit-new-beta branch February 15, 2016 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Retrofit 2 beta4 + OkHttp 3 Http logging interceptor should be compiled only into debug build
3 participants