Android Question [SOLVED] exoplayer (media3) change DataSourceFactory issue

dune3000

Member
Licensed User
Longtime User
Hi, there
I want to replace DefaultDataSource with OkHttpDataSource, so I modify the SimpleExoPlayerWrapper.java like this
B4X:
public DefaultDataSource.Factory createDefaultDataFactory() {
        OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
        OkHttpDataSource.Factory factory = new OkHttpDataSource.Factory(okHttpClient);
        return new DefaultDataSource.Factory(BA.applicationContext, factory);
}
and use SLC to compile it, no error.
I use it to recompile the ExoPlayerExample, no error.
While running the apk, got these error message:
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
java.lang.NoClassDefFoundError: com.google.common.util.concurrent.SettableFuture
    at androidx.media3.datasource.okhttp.OkHttpDataSource.executeCall(OkHttpDataSource.java:469)
    at androidx.media3.datasource.okhttp.OkHttpDataSource.open(OkHttpDataSource.java:316)
    at androidx.media3.datasource.DefaultDataSource.open(DefaultDataSource.java:272)
    at androidx.media3.datasource.StatsDataSource.open(StatsDataSource.java:86)
    at androidx.media3.datasource.DataSourceInputStream.checkOpened(DataSourceInputStream.java:101)
    at androidx.media3.datasource.DataSourceInputStream.open(DataSourceInputStream.java:64)
    at androidx.media3.exoplayer.upstream.ParsingLoadable.load(ParsingLoadable.java:182)
    at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:417)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:818)
java.lang.NoClassDefFoundError: com.google.common.util.concurrent.SettableFuture
    at androidx.media3.datasource.okhttp.OkHttpDataSource.executeCall(OkHttpDataSource.java:469)
    at androidx.media3.datasource.okhttp.OkHttpDataSource.open(OkHttpDataSource.java:316)
    at androidx.media3.datasource.DefaultDataSource.open(DefaultDataSource.java:272)
    at androidx.media3.datasource.StatsDataSource.open(StatsDataSource.java:86)
    at androidx.media3.datasource.DataSourceInputStream.checkOpened(DataSourceInputStream.java:101)
    at androidx.media3.datasource.DataSourceInputStream.open(DataSourceInputStream.java:64)
    at androidx.media3.exoplayer.upstream.ParsingLoadable.load(ParsingLoadable.java:182)
    at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:417)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:818)

I had used "#AdditionalJar: guava-31.1-android.jar" in Main
 
Top