TeamNewPipe / NewPipeExtractor

NewPipe's core library for extracting data from streaming sites
GNU General Public License v3.0
1.4k stars 421 forks source link

java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets #836

Closed codeage closed 2 years ago

codeage commented 2 years ago

StandardCharsets.UTF_8 was added in [API level 19], so it is not supported by older Android systems. Please use Charset.forName("UTF-8") instead.

java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets
    at org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeCommentsExtractor.onFetchPage(YoutubeCommentsExtractor.java:257)
    at org.schabi.newpipe.extractor.Extractor.fetchPage(Extractor.java:60)
    at org.schabi.newpipe.extractor.comments.CommentsInfo.getInfo(CommentsInfo.java:39)
    at org.schabi.newpipe.extractor.comments.CommentsInfo.getInfo(CommentsInfo.java:29)
    at org.schabi.newpipelegacy.util.ExtractorHelper.lambda$getCommentsInfo$7(ExtractorHelper.java:165)
    at org.schabi.newpipelegacy.util.-$$Lambda$ExtractorHelper$c05hNbPsgDxL7UDIeF-SWkm_CC0.call(lambda)
    at io.reactivex.rxjava3.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:43)
    at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4813)
    at io.reactivex.rxjava3.internal.operators.single.SingleDoOnSuccess.subscribeActual(SingleDoOnSuccess.java:35)
    at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4813)
    at io.reactivex.rxjava3.internal.operators.maybe.MaybeFromSingle.subscribeActual(MaybeFromSingle.java:41)
    at io.reactivex.rxjava3.core.Maybe.subscribe(Maybe.java:5330)
    at io.reactivex.rxjava3.internal.operators.maybe.MaybeConcatArray$ConcatMaybeObserver.drain(MaybeConcatArray.java:153)
    at io.reactivex.rxjava3.internal.operators.maybe.MaybeConcatArray$ConcatMaybeObserver.request(MaybeConcatArray.java:78)
    at io.reactivex.rxjava3.internal.operators.flowable.FlowableElementAtMaybe$ElementAtSubscriber.onSubscribe(FlowableElementAtMaybe.java:66)
    at io.reactivex.rxjava3.internal.operators.maybe.MaybeConcatArray.subscribeActual(MaybeConcatArray.java:42)
    at io.reactivex.rxjava3.core.Flowable.subscribe(Flowable.java:15753)
    at io.reactivex.rxjava3.internal.operators.flowable.FlowableElementAtMaybe.subscribeActual(FlowableElementAtMaybe.java:36)
    at io.reactivex.rxjava3.core.Maybe.subscribe(Maybe.java:5330)
    at io.reactivex.rxjava3.internal.operators.maybe.MaybeToSingle.subscribeActual(MaybeToSingle.java:46)
    at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4813)
    at io.reactivex.rxjava3.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
    at io.reactivex.rxjava3.core.Scheduler$DisposeTask.run(Scheduler.java:614)
    at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:65)
    at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:56)
    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    at java.lang.Thread.run(Thread.java:856)
Stypox commented 2 years ago

You should use desugaring like we do in NewPipe

codeage commented 2 years ago

You should use desugaring like we do in NewPipe

I'm currently working on the NewPipe-legacy project, which has deugaring enabled. as you can see, the logcat above is from the YouTube-legacy application.

image

AudricV commented 2 years ago

Yes, this class is not yet available with Desugar, which has been updated to Java 11 (not released) and include the StandardCharset class: see https://github.com/google/desugar_jdk_libs and https://r8.googlesource.com/r8/+/refs/heads/main.

So you may except something in the coming days, months or weeks.

codeage commented 2 years ago

Yes, this class is not yet available with Desugar, which has been updated to Java 11 (not released) and include the StandardCharset class: see https://github.com/google/desugar_jdk_libs and https://r8.googlesource.com/r8/+/refs/heads/main.

So you may except something in the coming days, months or weeks.

Thank you!

AudricV commented 2 years ago

Good news! A new version of Desugar has been released, 1.2.0: see https://github.com/google/desugar_jdk_libs/blob/master/CHANGELOG.md. This will require version 7.3.0-beta03 of the Android Gradle Plugin, according to the changelog.

You will probably able to build soon the legacy app using the latest extractor version, with the Electric Eel version of Android Studio.

Closing as won't fix, as we won't downgrade to older Java version and APIs. Thank you!