From ecaeede52724a173b7a579570f42f576bf7f8082 Mon Sep 17 00:00:00 2001 From: Saravanan Date: Sun, 29 Jan 2023 22:52:03 +0530 Subject: [PATCH] RN Upgrade: Android fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit details: (these are purely my logs of what issues I faced and the fixes I tried, not necessarily included in the commit) - [x] AOS: [refer: https://reactnative.dev/docs/environment-setup] - [x] Issue: “> Task :app:installDebug FAILED” ; Solution: worked only on real device and not on the simulator after doing this: adb kill-server && adb start-server && adb devices && rpm run android [refer: https://stackoverflow.com/a/28211161/1374730] - [x] Issue: “More than one file was found with OS independent path 'lib/armeabi-v7a/libfbjni.so'” ; Solution: [refer: https://stackoverflow.com/a/74526307/1374730] - [x] Issue: “Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector$DumpInfoEntry found in modules jetified-imagepipeline-base-2.5.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.5.0) and jetified-stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)” ; Solution: [refer: https://stackoverflow.com/a/72838513/1374730] - [x] Issue: “android:attr/lStar not found” [refer: https://stackoverflow.com/a/72838513/1374730] - [x] Issue: “> Task :react-native-community_slider:generateDebugRFile FAILED” ; Solution: “changed `compileSdkVersion` to 30” [refer: https://github.com/callstack/react-native-slider/issues/325#issuecomment-938762391] & another solution: [refer: https://stackoverflow.com/a/66673453/1374730] - [x] Issue: “> Task :react-native-sound:compileDebugJavaWithJavac FAILED” ; Solution: cd android && ./gradlew clean && cd .. && npx jetify [refer: https://www.appsloveworld.com/react-native/100/171/react-native-execution-failed-for-task-react-native-audiocompilereleasejavaw] - [x] Issue: “> java heap space” ; Solution: [refer: https://stackoverflow.com/a/69239438/1374730] - [x] Issue: “Caused by: java.io.IOException: Cannot run program "node" (in directory "): error=2, No such file or directory” ; Solution: [refer: https://stackoverflow.com/a/69681064/1374730] - [x] Issue: “> Cannot get property 'supportLibVersion' on extra properties extension as it does not exist” ; Solution: [refer: https://github.com/software-mansion/react-native-reanimated/issues/280#issuecomment-494297886] --- android/app/build.gradle | 5 +---- android/build.gradle | 16 +++++++++++----- android/gradle.properties | 4 +++- android/gradle/wrapper/gradle-wrapper.properties | 6 +++--- package.json | 3 ++- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 1a74faac..36e231c6 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -167,10 +167,7 @@ android { } packagingOptions { - pickFirst "lib/armeabi-v7a/libc++_shared.so" - pickFirst "lib/arm64-v8a/libc++_shared.so" - pickFirst "lib/x86/libc++_shared.so" - pickFirst "lib/x86_64/libc++_shared.so" + pickFirst '**/*.so' } // applicationVariants are e.g. debug, release diff --git a/android/build.gradle b/android/build.gradle index 7f648dc8..e5f33ee1 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,17 +2,18 @@ buildscript { ext { - buildToolsVersion = "28.0.3" - minSdkVersion = 16 - compileSdkVersion = 28 - targetSdkVersion = 28 + buildToolsVersion = "30.0.3" + minSdkVersion = 21 + compileSdkVersion = 31 + targetSdkVersion = 31 + supportLibVersion = "30.0.0" } repositories { google() jcenter() } dependencies { - classpath("com.android.tools.build:gradle:3.5.2") + classpath('com.android.tools.build:gradle:3.6.4') // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -34,4 +35,9 @@ allprojects { jcenter() maven { url 'https://www.jitpack.io' } } + configurations.all { + resolutionStrategy { + force 'com.facebook.react:react-native:0.62.2' //select Version you used + } + } } diff --git a/android/gradle.properties b/android/gradle.properties index ae1470f5..4a9395ee 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -7,4 +7,6 @@ android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true # Version of flipper SDK to use with React Native -FLIPPER_VERSION=0.33.1 \ No newline at end of file +FLIPPER_VERSION=0.99.0 +org.gradle.jvmargs=-Xmx2g -XX\:MaxHeapSize\=4g +org.gradle.java.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 8d863604..85da4285 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Nov 28 23:45:05 IST 2017 +#Sun Jan 29 21:07:39 IST 2023 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-rc-1-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/package.json b/package.json index 7369fea2..bcb77ffd 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "lint": "eslint ." }, "dependencies": { - "@react-native-community/slider": "^4.4.1", + "@react-native-community/slider": "^3.0.3", + "jetifier": "^2.0.0", "react": "16.11.0", "react-native": "0.62.2", "react-native-sound": "^0.11.0"