Skip to content

ACCESS_NETWORK_STATE permission being mandatory since 2.10.0 #6019

@tibbi

Description

@tibbi

[REQUIRED] Issue description

The library requires the android.permission.ACCESS_NETWORK_STATE permission since version 2.10.0, it crashes at initialization via ExoPlayerFactory.newSimpleInstance(context), if not granted. I'm using the library only for playing locally stored offline videos, so is there any way I can tell ExoPlayer to just ignore everything internet related and work offline? IMHO that should be the default behaviour. Wrapping whole ExoPlayerFactory.newSimpleInstance(context) in a try/catch block will catch the exception, but then I won't receive a usable ExoPlayer instance.

Crashdump:

Process: com.simplemobiletools.gallery.pro.debug, PID: 5873
java.lang.SecurityException: ConnectivityService: Neither user 10901 nor current process has android.permission.ACCESS_NETWORK_STATE.
    at android.os.Parcel.createException(Parcel.java:1950)
    at android.os.Parcel.readException(Parcel.java:1918)
    at android.os.Parcel.readException(Parcel.java:1868)
    at android.net.IConnectivityManager$Stub$Proxy.getActiveNetworkInfo(IConnectivityManager.java:1216)
    at android.net.ConnectivityManager.getActiveNetworkInfo(ConnectivityManager.java:924)
    at com.google.android.exoplayer2.util.Util.getNetworkType(Util.java:1716)
    at com.google.android.exoplayer2.upstream.DefaultBandwidthMeter.<init>(DefaultBandwidthMeter.java:263)
    at com.google.android.exoplayer2.upstream.DefaultBandwidthMeter.<init>(DefaultBandwidthMeter.java:48)
    at com.google.android.exoplayer2.upstream.DefaultBandwidthMeter$Builder.build(DefaultBandwidthMeter.java:189)
    at com.google.android.exoplayer2.ExoPlayerFactory.getDefaultBandwidthMeter(ExoPlayerFactory.java:446)
    at com.google.android.exoplayer2.ExoPlayerFactory.newSimpleInstance(ExoPlayerFactory.java:337)
    at com.google.android.exoplayer2.ExoPlayerFactory.newSimpleInstance(ExoPlayerFactory.java:299)
    at com.google.android.exoplayer2.ExoPlayerFactory.newSimpleInstance(ExoPlayerFactory.java:193)
    at com.google.android.exoplayer2.ExoPlayerFactory.newSimpleInstance(ExoPlayerFactory.java:127)
    at com.google.android.exoplayer2.ExoPlayerFactory.newSimpleInstance(ExoPlayerFactory.java:115)
    at com.google.android.exoplayer2.ExoPlayerFactory.newSimpleInstance(ExoPlayerFactory.java:105)
    at com.simplemobiletools.gallery.pro.fragments.VideoFragment.setupPlayer(VideoFragment.kt:280)
    ...

[REQUIRED] Reproduction steps

The library itself has the required permission declared in the manifest file, but my app is offline and I don't want to request it, so I'm removing the permission with <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" tools:node="remove"/> in my apps manifest file.

[REQUIRED] Version of ExoPlayer being used

It is broken at com.google.android.exoplayer:exoplayer-core:2.10.1 (also 2.10.0), it used to work just fine with 2.9.6. I'm not using any other modules.

[REQUIRED] Device(s) and version(s) of Android being used

Testing on Android 9, but it doesn't matter in this case.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions