Package
native_dio_adapter
Version
1.5.0
Operating-System
Android
Adapter
NativeAdapter
Steps to Reproduce
- Create an Android emulator that does not have access to Google Play Services (select Services -> Android Open Source)
- Make a network request on a
Dio instance with a NativeAdapter
- Note that the request fails and an exception is thrown when initializing the
CronetEngine.
Expected Result
NativeAdapter should gracefully handle devices without Google Play services (for example by falling back on IOClient).
Cronet can be embedded as a workaround but in my opinion it's quite a big footgun that all network requests fail on certain devices if the developer is not aware of how cronet_http interacts with Google Play services.
I created a draft PR with a possible approach for handling the issue.
Actual Result
NativeAdapter throws an exception and network requests fail.
JniException (Exception in Java code called through JNI: java.lang.RuntimeException: All available Cronet providers are disabled. A provider should be enabled before it can be used.
java.lang.RuntimeException: All available Cronet providers are disabled. A provider should be enabled before it can be used.
at org.chromium.net.CronetEngine$Builder.getEnabledCronetProviders(CronetEngine.java:365)
at org.chromium.net.CronetEngine$Builder.createBuilderDelegate(CronetEngine.java:327)
at org.chromium.net.CronetEngine$Builder.<init>(CronetEngine.java:75)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:346)
at android.os.Looper.loopOnce(Looper.java:189)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8705)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
)
Package
native_dio_adapter
Version
1.5.0
Operating-System
Android
Adapter
NativeAdapter
Steps to Reproduce
Dioinstance with aNativeAdapterCronetEngine.Expected Result
NativeAdaptershould gracefully handle devices without Google Play services (for example by falling back onIOClient).Cronet can be embedded as a workaround but in my opinion it's quite a big footgun that all network requests fail on certain devices if the developer is not aware of how
cronet_httpinteracts with Google Play services.I created a draft PR with a possible approach for handling the issue.
Actual Result
NativeAdapterthrows an exception and network requests fail.