Fix: Specify Namespace in rn-fetch-blob for Android Compatibility
josebrc opened this issue ยท 0 comments
josebrc commented
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.
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..30ac197 100644
--- a/node_modules/rn-fetch-blob/android/build.gradle
+++ b/node_modules/rn-fetch-blob/android/build.gradle
@@ -1,46 +1,26 @@
apply plugin: 'com.android.library'
-def safeExtGet(prop, fallback) {
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
-}
-
-repositories {
- mavenCentral()
- jcenter()
- google()
-}
-
-buildscript {
- repositories {
- jcenter()
- google()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:3.2.1'
- }
-}
-
android {
- compileSdkVersion safeExtGet('compileSdkVersion', 28)
- buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
+ compileSdkVersion rootProject.ext.compileSdkVersion ?: 30
+ buildToolsVersion rootProject.ext.buildToolsVersion ?: "30.0.2"
+ namespace "com.RNFetchBlob" // add this line
+
defaultConfig {
- minSdkVersion safeExtGet('minSdkVersion', 16)
- targetSdkVersion safeExtGet('targetSdkVersion', 28)
+ minSdkVersion 16
+ targetSdkVersion rootProject.ext.targetSdkVersion ?: 30
versionCode 1
versionName "1.0"
}
+
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
- productFlavors {
- }
}
dependencies {
- implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
- //compile 'com.squareup.okhttp3:okhttp:+'
- //{RNFetchBlob_PRE_0.28_DEPDENDENCY}
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'com.facebook.react:react-native:+'
}
This issue body was partially generated by patch-package.