Fetch icon indicating copy to clipboard operation
Fetch copied to clipboard

Please adapt for Android 14

Open kanglongba opened this issue 1 year ago • 31 comments

Please adapt for Android 14. The framework dynamically registers a broadcast that needs to be adapted to the security policies of Android 14.

kanglongba avatar Jul 14 '23 07:07 kanglongba

I am also facing the same issue, Here's the exception : java.lang.SecurityException : com.my.packagename : One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

VikasTiwari199915 avatar Aug 12 '23 12:08 VikasTiwari199915

My app also depends on Fetch and requires this update to adapt to Android 14.

Here's a reference of what change we're talking about: https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported

Thanks.

barantes avatar Nov 13 '23 13:11 barantes

I'm also facing the same issue. Please update it🙏🏽

ShayShimoni avatar Nov 21 '23 13:11 ShayShimoni

Hey, I made it work with android 14 and upgrade all dependencies to latest version. You guys can try with https://github.com/tonyofrancis/Fetch/pull/665

helloimfrog avatar Dec 11 '23 08:12 helloimfrog

Hey, I made it work with android 14 and upgrade all dependencies to latest version. You guys can try with #665

How to use that one man?

amrashraf1992 avatar Dec 11 '23 23:12 amrashraf1992

Try it out: new prereleases using the code of @helloimfrog from pull request #665

Please give me any feedback!

https://github.com/Kutikov/fetch2-android/releases/tag/3.2.1-android14

Kutikov avatar Dec 12 '23 16:12 Kutikov

@amrashraf1992 , @ShayShimoni , @barantes , @VikasTiwari199915 , @kanglongba and everyone who wants to test by himself LASTEST VERSION download prebuild *.aar.

Give me any feedback, please!

Kutikov avatar Dec 13 '23 12:12 Kutikov

@Kutikov Hello thank you for the update. I've tried to add the lib with implementation "androidx.tonyodev.fetch2:xfetch2:3.2.2" but it doesn't find it nor 3.2.1, How can i import this lib you updated to Android 14 through a dependency?

ShayShimoni avatar Dec 25 '23 08:12 ShayShimoni

@ShayShimoni , you can use prebuild .aar on link in prevoius comment. I'm sorry to not loading them to maven, for now I don't have enough knowledge to do this for fetch project. If someone can help me, let me know!

Kutikov avatar Dec 25 '23 10:12 Kutikov

We can use https://developer.android.com/reference/android/app/DownloadManager as an alternative. I migrated my code to it https://github.com/kesha-antonov/react-native-background-downloader/blob/3.0.0/android/src/main/java/com/eko/RNBackgroundDownloaderModule.java

And it works quite well!

kesha-antonov avatar Dec 25 '23 12:12 kesha-antonov

@kesha-antonov Thx for commenting. Yeah i've seen this DownloadManager, it has almost the same capabilities but i didn't see if it has the option to resume a download from the last point it was stopped, and i need this feature. Correct me if i'm wrong.

ShayShimoni avatar Dec 28 '23 11:12 ShayShimoni

@kesha-antonov Thx for commenting. Yeah i've seen this DownloadManager, it has almost the same capabilities but i didn't see if it has the option to resume a download from the last point it was stopped, and i need this feature. Correct me if i'm wrong.

It doesn't have option to pause/resume as I saw. But it depends on your use case. You enqueue download, app can be stopped and later after you reopen you continue download file not from zero bytes but where it stopped.

kesha-antonov avatar Dec 28 '23 11:12 kesha-antonov

you can use this dependency for android 14

implementation "com.github.abbas7777:fetch2-android14:3.2.0-beta07"

Abbas7777 avatar Jan 31 '24 12:01 Abbas7777

@kesha-antonov Thx for commenting. Yeah i've seen this DownloadManager, it has almost the same capabilities but i didn't see if it has the option to resume a download from the last point it was stopped, and i need this feature. Correct me if i'm wrong.

It doesn't have option to pause/resume as I saw. But it depends on your use case. You enqueue download, app can be stopped and later after you reopen you continue download file not from zero bytes but where it stopped.

Thanks to see you here, as I tried to use your "@kesha-antonov/react-native-background-downloader" package and It's working fine in android 14 as well but there's no pause and resume option and I really need it so I used the old "react-native-background-downloader" package which is using Fetch library to download the contents in android and is giving the pause and resume option but that was not working in android 14 so I used this, 'implementation "com.github.abbas7777:fetch2-android14:3.2.0-beta02"' library and it fixed my problem so can you please update your library

Thanks in advance

MdAbubakar avatar Apr 05 '24 07:04 MdAbubakar

@abbas7777 Can you share a link to the fork/repository as well please?

fabiendem avatar Apr 30 '24 12:04 fabiendem

@Kutikov can you please upload the prebuild aar files , with the proguard customized ?

Problems occuring : can't see the public classes of the libraries and javadoc is removed .

Here are some rules that you can add : -keep public class * { *; } -keepattributes SourceFile,LineNumberTable, Annotation

LeoRudra avatar May 05 '24 13:05 LeoRudra

@fabiendem hello hear you are... https://github.com/abbas7777/fetch2-android14

Abbas7777 avatar May 05 '24 17:05 Abbas7777

Yes Same for me today i update version its started gave error

rovedashcam avatar Jun 18 '24 20:06 rovedashcam

Try it out: new prereleases using the code of @helloimfrog from pull request #665

Please give me any feedback!

https://github.com/Kutikov/fetch2-android/releases/tag/3.2.1-android14

I am getting Error when i try to implementation "androidx.tonyodev.fetch2:xfetch2:3.2.1" its telling can not find

rovedashcam avatar Jun 18 '24 21:06 rovedashcam

com.github.abbas7777:fetch2-android14:3.2.0-beta02

java.lang.IllegalArgumentException: Unsupported class file major version 61. getting this error when i implementation "com.github.abbas7777:fetch2-android14:3.2.0-beta02" any solution?

rovedashcam avatar Jun 18 '24 21:06 rovedashcam

com.github.abbas7777:fetch2-android14:3.2.0-beta02

java.lang.IllegalArgumentException: Unsupported class file major version 61. getting this error when i implementation "com.github.abbas7777:fetch2-android14:3.2.0-beta02" any solution?

you can use com.github.abbas7777:fetch2-android14:3.2.0-beta07

Abbas7777 avatar Jun 19 '24 04:06 Abbas7777

com.github.abbas7777:fetch2-android14:3.2.0-beta07 Screenshot 2024-06-19 at 11 12 18 PM still ai am getting same error can you please help me if i am doing some thing wrong

rovedashcam avatar Jun 19 '24 17:06 rovedashcam

com.github.abbas7777:fetch2-android14:3.2.0-beta07

Screenshot 2024-06-19 at 11 12 18 PM still ai am getting same error can you please help me if i am doing some thing wrong

You need to have the Java version which is compatible with your Gradle version, and configure Gradle to use exactly that version

Abbas7777 avatar Jun 19 '24 18:06 Abbas7777

Can you please tell me which java version we need to set? currently we i am using 11.0.19

rovedashcam avatar Jun 19 '24 19:06 rovedashcam

Can you please tell me which java version we need to set? currently we i am using 11.0.19

You must use 17 and also update gradle version to compatible with this

Abbas7777 avatar Jun 20 '24 03:06 Abbas7777

can you tell me gradle version ? so you mean it will not support java 11.0.19 if we will target android 34

rovedashcam avatar Jun 26 '24 15:06 rovedashcam

using com.github.abbas7777:fetch2-android14:3.2.0-beta07 worked but it would be great to have this included in the original package

Verdurakh avatar Jul 11 '24 06:07 Verdurakh

Hello guys, please, I noticed a comment somewhere (cannot find it anymore) saying there is a delay before the actual download starts on <34,..) devices . When I use "com.github.abbas7777:fetch2-android14:3.2.0-beta07" it works fine, but once I build lib locally ./gradlew build using generated (debug/release) aar I also observe that 15-20s delay. Do you know why? I'm building branches v3.0x and v3x-develop. Both should contain all necessary changes, but the outcome is the same 20s delay with local aar. @abbas7777 you work contains also some additional fixes different from those branches? @Kutikov maybe have you observed this behaviour as well please?

nosko avatar Jul 18 '24 12:07 nosko

Hello guys, please, I noticed a comment somewhere (cannot find it anymore) saying there is a delay before the actual download starts on <34,..) devices . When I use "com.github.abbas7777:fetch2-android14:3.2.0-beta07" it works fine, but once I build lib locally ./gradlew build using generated (debug/release) aar I also observe that 15-20s delay. Do you know why? I'm building branches v3.0x and v3x-develop. Both should contain all necessary changes, but the outcome is the same 20s delay with local aar. @abbas7777 you work contains also some additional fixes different from those branches? @Kutikov maybe have you observed this behaviour as well please?

No, but I use my own aars, so maybe some fixes from @abbas7777 or mine fixes helps to prevent any build lag

Kutikov avatar Jul 18 '24 13:07 Kutikov