Status Update
Comments
ys...@google.com <ys...@google.com> #3
It still fails after disabling the App Inspection from the view. Can I even disable this? Anything that messes with the byte code and can cause failures, should be possible to disable.
aa...@google.com <aa...@google.com> #4
For information of what’s needed in the report please don’t forget to read this guide at
aa...@google.com <aa...@google.com> #5
The code has changed significantly in recent builds.
Please confirm if this is still happening and include the error stack trace.
ys...@google.com <ys...@google.com> #6
Still happening on Iguana Beta 2.
10:25:35.812 E FATAL EXCEPTION: DefaultDispatcher-worker-2
Process: com.google.android.horologist.sample.debug, PID: 4328
java.lang.IllegalStateException: Cannot access request header fields after connection is set
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getRequestProperties(HttpURLConnectionImpl.java:236)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getRequestProperties(DelegatingHttpsURLConnection.java:183)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getRequestProperties(HttpsURLConnectionImpl.java:30)
at com.android.tools.profiler.support.network.httpurl.TrackedHttpURLConnection.getRequestProperties(TrackedHttpURLConnection.java:230)
at com.android.tools.profiler.support.network.httpurl.HttpsURLConnection$.getRequestProperties(HttpsURLConnection$.java:351)
at com.android.tools.appinspection.network.httpurl.TrackedHttpURLConnection.getRequestProperties(TrackedHttpURLConnection.kt:246)
at com.android.tools.appinspection.network.httpurl.TrackedHttpURLConnection.trackPreConnect(TrackedHttpURLConnection.kt:74)
at com.android.tools.appinspection.network.httpurl.TrackedHttpURLConnection.getInputStream(TrackedHttpURLConnection.kt:344)
at com.android.tools.appinspection.network.httpurl.HttpsURLConnectionWrapper.getInputStream(HttpsURLConnectionWrapper.kt:197)
at com.google.android.horologist.networks.NetworkScreenViewModel.getInputStream(NetworkScreenViewModel.kt:84)
at com.google.android.horologist.networks.NetworkScreenViewModel.access$getInputStream(NetworkScreenViewModel.kt:48)
at com.google.android.horologist.networks.NetworkScreenViewModel$makeRequests$1.invokeSuspend(NetworkScreenViewModel.kt:71)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@d8c3e03, Dispatchers.IO]
The code to reproduce is trivial
val url: URL = URL("https://www.google.com/robots.txt")
val urlConnection = url.openConnection() as HttpURLConnection
val inputStream = if ("gzip" == urlConnection.contentEncoding) {
GZIPInputStream(urlConnection.getInputStream())
} else urlConnection.getInputStream()
aa...@google.com <aa...@google.com> #7
I can repro.
It looks like the urlConnection.contentEncoding
statement is the root cause. It opens the connection and the OkHttp stack doesn't allow reading the headers after the connection is open.
The inspector already has code that handles this by reading the headers before executing any methods that open the connection.
For example, we do this for getHeaderField
, getContentType
etc'.
The problem is that we don't do it for getContentEncoding
.
aa...@google.com <aa...@google.com>
an...@google.com <an...@google.com> #8
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Jellyfish | 2023.3.1 Canary 8
- Android Gradle Plugin 8.4.0-alpha08
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
Description
Observed inhttps://codeberg.org/jannis/FitoTrack.git
This fails because
getInputStream()
is called aftergetContentEncoding()