joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.8k stars 767 forks source link

Remove namespace from AndroidManifest.xml's package attribute and move it to the module's build.gradle file #857

Open rahulsaipandit opened 8 months ago

rahulsaipandit commented 8 months ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch rn-fetch-blob@0.12.0 for the project I'm working on.

Using this package generates an error - Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated. Please instead set the namespace (or testNamespace) in the module's build.gradle file, as described here: https://developer.android.com/studio/build/configure-app-module#set-namespace
This migration can be done automatically using the AGP Upgrade Assistant, please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.

Here is the diff that solved my problem:

diff --git a/node_modules/rn-fetch-blob/android/build.gradle b/node_modules/rn-fetch-blob/android/build.gradle
index a4ca7a4..7fd5c79 100644
--- a/node_modules/rn-fetch-blob/android/build.gradle
+++ b/node_modules/rn-fetch-blob/android/build.gradle
@@ -21,6 +21,7 @@ buildscript {
 }

 android {
+   namespace "com.RNFetchBlob"
     compileSdkVersion safeExtGet('compileSdkVersion', 28)
     buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
     defaultConfig {
diff --git a/node_modules/rn-fetch-blob/android/src/main/AndroidManifest.xml b/node_modules/rn-fetch-blob/android/src/main/AndroidManifest.xml
index 1c92420..5795152 100644
--- a/node_modules/rn-fetch-blob/android/src/main/AndroidManifest.xml
+++ b/node_modules/rn-fetch-blob/android/src/main/AndroidManifest.xml
@@ -1,5 +1,4 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.RNFetchBlob">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">

     <!-- Required to access Google Play Licensing -->
     <uses-permission android:name="com.android.vending.CHECK_LICENSE" />

This issue body was partially generated by patch-package.