Okhttp: ProGuard and 4.0.1 OkHttp issue

Created on 2 Aug 2019  路  11Comments  路  Source: square/okhttp

Hello,

I updated from 3.14.2 to 4.0.1 today.

With 4.0.1 I cannot make a release build because the build gets stuck in the ProGuard phase, "Optimizing (pass 1/5)". The whole process usually takes around 10 min, I stopped after 120 minutes as it was stuck there. Cleaned up everything, restarted Android Studio, same thing.
I reverted to 3.14.2 and build is successful again.

Any idea what could cause this issue?

bug proguard

All 11 comments

Looking on Google, I found something similar a few months ago on Okio: https://github.com/square/okio/issues/516

I'm not the person to help, but to get full information out, what version of proguard are you using?

I am using the one dependant on Android Gradle.
Running "./gradlew buildEnvironment" I can see it's version 6.0.3.

Other info found along the way:

  • com.android.tools.build:gradle:3.4.2
  • wrapper version 5.1.1

FYI forcing the use of the latest ProGuard version (6.1.1) ends up with the ProGuard build phase failing with an ArrayIndexOutOfBoundsException error.

https://square.github.io/okhttp/upgrading_to_okhttp_4/#r8-proguard

Does the section on ProGuard here help?

You may want to switch to R8, it fixes all those issues, else you need to report to Proguard I thought 6.1 fixed both issues but it seems they only fixed one.

Ok thanks. I'll try to switch to R8 then, it sounds easy enough if I can trust the Android Studio docs :)

I also encountered this problem and can reproduce it. I can provide a simple reproduction project if needed. @swankjesse

Using okhttp 4 and ProGuard optimizations will never end in the Optimizing (pass 1/5) process.

Thanks!

After upgrading to ProGuard 6.2.0/6.1.1, it is fixed.

After upgrading to ProGuard 6.2.0/6.1.1, it is fixed.

this works for me,Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings