psambit9791 / jdsp

A Java Library for Digital Signal Processing
https://jdsp.dev
MIT License
240 stars 45 forks source link

problem with stream usage in FIRWin1.java when used in andriod api below 24 #40

Closed Eldho-Abraham-coder closed 1 year ago

Eldho-Abraham-coder commented 2 years ago

Hi Thanks for your jdsp library , i could actually develop a hamiltion segmentator for ecg processing with it. But when i tried to integrate with andriod API below 24 i am getting this error java.lang.NoSuchMethodError: No static method stream([D)Ljava/util/stream/DoubleStream; in class Ljava/util/Arrays; or its super classes (declaration of 'java.util.Arrays' appears in /system/framework/core-libart.jar) at com.github.psambit9791.jdsp.filter.FIRWin1.computeCoefficients(FIRWin1.java:270) at com.piccolomed.smartpicc.ecg.PeakDetector.apply_fir_filter(PeakDetector.java:651) at com.piccolomed.smartpicc.ecg.PeakDetector.apply_fir_filter_filtfilt(PeakDetector.java:657) at com.piccolomed.smartpicc.ecg.PeakDetector.getPeaks(PeakDetector.java:29)

i am currently using version 0.8.0 of you library, it seems stream are not supported in older versions of android. is there any other alternative

psambit9791 commented 2 years ago

Thanks for choosing JDSP.

Although I'm not particularly aware of Android's limitations below API version 24, the Stream API was introduced in API 24.

In terms of alternatives, I found this link which refers to streamsupport. However, this post from Android mentions the usage of Stream API without a minimum API level.

So, I would start there.

psambit9791 commented 2 years ago

@Eldho-Abraham-coder

Were you able to resolve this issue?

Eldho-Abraham-coder commented 2 years ago

i tried different solutions eg:https://developer.android.com/studio/write/java8-support#library-desugaring But getting error A problem occurred evaluating project ':ecg'.

No signature of method: build_8mtuzkwucz3q941c0e2m8ls19.android() is applicable for argument types: (build_8mtuzkwucz3q941c0e2m8ls19$_run_closure2) values: [build_8mtuzkwucz3q941c0e2m8ls19$_run_closure2@1624c3a0]

psambit9791 commented 1 year ago

I don't think there is any inherent problem with the library itself. We are expecting people to use Android versions from 7 and above, to develop with JDSP.

Closing the issue.