Warning after installing react-navigation in a react native project - android

I'm new to React Native. I'm learning navigation, so I started with a brand new react native project and followed the steps on the React Navigation website (react navigation doc) :
1) npm install --save react-navigation
2) npm install --save react-native-gesture-handler (not using expo)
3) react-native link react-native-gesture-handler
4) Modify the MainActivity.java as the website says for Android
Then, when I run the command react-native run-android, I see the app in my phone as expected but the following message appears:
Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Task :react-native-gesture-handler:compileDebugJavaWithJavac
Note: /home/ana/code/react native/seeCompileError/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
I'm on Linux Mint 19 running the code on my physical Android phone.
My build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}
My package.json file:
{
"name": "seeCompileError",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"jwt-decode": "^2.2.0",
"react": "16.6.3",
"react-native": "0.57.8",
"react-native-gesture-handler": "^1.0.12",
"react-navigation": "^3.0.9",
"react-redux": "^6.0.0",
"redux": "^4.0.1",
"redux-persist": "^5.10.0",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.51.1",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
}
I would appreciate any hint or help, thank you.

Compile vs Implementation
When you use react-native link it adds the dependency to your build.gradle file; depending on how the dependency has been setup it adds it with compile or implementation. It's easy for you to fix, you can just manually change it to implementation
So in your build.gradle(Module: app) you can change
compile project(':react-native-gesture-handler')
to
implementation project(':react-native-gesture-handler')
You can read more about the differences between Compile and Implementation here: What's the difference between implementation and compile in Gradle?
react-native-gesture-handler
If react-native-gesture-handler is using or overriding deprecated APIs you could flag an issue on their repo, or fix it yourself by making a pull request.
Deprecated apis could be removed without warning making the dependency unusable/unstable. The deprecated apis could also have flaws in them, hence the reason they are deprecated, and these may cause you issues in the future.
But as you are require to use react-native-gesture-handler when using react-navigation you are a bit limited in what you can do.
As I have already said there are several options: flag the issue, fix it yourself with a pull-request, don't use it react-navigation until react-native-gesture-handler is fixed, or you can use it.

Related

Execution failed for task ':react-native-webview:compileDebugKotlin'

After upgrading react native from 0.61.2 to 0.68.2 with RN update helper, gradle cant build app. Getting this error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-webview:compileDebugKotlin'.
java.io.IOException: Permission denied
trying all react-native-webview versions but result is same.
when i removeing "react-native-webview": "^8.0.3" this line from package.json file then build successfully goes but app getting error because this dependency used in app
below dependency versions which i using.
"react": "17.0.2",
"react-native": "0.68.2",
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-all.zip
android/build.gralde
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888"
} else {
// Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "21.4.7075529"
}
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.4")
classpath 'com.google.gms:google-services:4.3.8'
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:4.1.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
If you face the issue from Nov 4th 2022,
Fix for react-native >= 0.63 and lower than 0.67
In android/buld.gradle file,
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
// ...
}
allprojects {
repositories {
+ exclusiveContent {
+ // We get React Native's Android binaries exclusively through npm,
+ // from a local Maven repo inside node_modules/react-native/.
+ // (The use of exclusiveContent prevents looking elsewhere like Maven Central
+ // and potentially getting a wrong version.)
+ filter {
+ includeGroup "com.facebook.react"
+ }
+ forRepository {
+ maven {
+ // NOTE: if you are in a monorepo, you may have "$rootDir/../../../node_modules/react-native/android"
+ url "$rootDir/../node_modules/react-native/android"
+ }
+ }
+ }
// ...
}
}
What this fix will do is apply an exclusiveContent resolution rule that will force the resolution of React Native Android library, to use the one inside node_modules.
Once you update your app to React Native v0.71.0, this fix won't be needed anymore.
Fix for older react-native (< 0.63)
The fix above only works on gradle 6.2 and higher. Older react-native used older gradle.
You may determine your gradle version by looking in your /android/gradle/wrapper/gradle-wrapper.properties file.
If you are on older react-native (for example 0.63 or earlier) that uses gradle version 6.1 or below, you must use a different workaround, detailed here: #35210 (comment)
Updated On Nov 11th 2022
If the above solution is not working for you then try this one.
In android/buld.gradle file,
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
configurations.all {
resolutionStrategy {
// Remove this override in 0.66, as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
// ...
}
Try running this command on the android folder.
sudo ./gradlew compileDebugKotlin
This worked for me.
If you don't want to use in your project then remove it by uninstall lib not only from package.json
npm uninstall react-native-webview
If you want to use then, Please Update it to latest version of it:
"react-native-webview": "^11.17.2",
For ios:
delete pods and reinstall pods
cd ios && pod install
For Android:
delete build and rebuild it
Hope it works!
Upgarding your react native version can work
0.63.x to 0.63.5
0.65.x to 0.65.3
0.66.x to 0.66.5
0.68.x to 0.68.5
0.69.x to 0.69.7
0.70.x to 0.70.5
You can try the below setting inside android/build.gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
kotlin_version = '1.6.10'
}
repositories {
mavenCentral()
google()
jcenter()
maven { url "https://dl.bintray.com/android/android-tools/" }
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.2")
classpath 'com.google.gms:google-services:4.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// Add the Crashlytics Gradle plugin (be sure to add version
// 2.0.0 or later if you built your app with Android Studio 4.1).
// classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
// classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
}
}
allprojects {
repositories {
exclusiveContent {
// We get React Native's Android binaries exclusively through npm,
// from a local Maven repo inside node_modules/react-native/.
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
// and potentially getting a wrong version.)
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
// NOTE: if you are in a monorepo, you may have "$rootDir/../../../node_modules/react-native/android"
url "$rootDir/../node_modules/react-native/android"
}
}
}
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../../../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../../../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
I was using react-native version 0.64.0, then based on this issue, I upgraded to 0.64.4 and everything is fine now.
this is the useful part of the issue's solution:
๐Ÿ“ข Patches for >= 0.63 We have prepared releases for all the main
versions of react-native with an hotfix:
๐Ÿ›ณ 0.70.5:
https://github.com/facebook/react-native/releases/tag/v0.70.5 ๐Ÿ›ณ๏ธ
0.69.7: https://github.com/facebook/react-native/releases/tag/v0.69.7 ๐Ÿ›ณ 0.68.5:
https://github.com/facebook/react-native/releases/tag/v0.68.5 ๐Ÿ›ณ๏ธ
0.67.5: https://github.com/facebook/react-native/releases/tag/v0.67.5 ๐Ÿ›ณ๏ธ 0.66.5:
https://github.com/facebook/react-native/releases/tag/v0.66.5 ๐Ÿ›ณ๏ธ
0.65.3: https://github.com/facebook/react-native/releases/tag/v0.65.3 ๐Ÿ›ณ๏ธ 0.64.4:
https://github.com/facebook/react-native/releases/tag/v0.64.4 ๐Ÿ›ณ๏ธ
0.63.5: https://github.com/facebook/react-native/releases/tag/v0.63.5
By updating to these patch versions, your Android build should start
working again.
To do so, in your package.json change react-native's version to the
relevant new patch (ex. if you are on 0.64.3, change to 0.64.4) and
run yarn install. No other changes should be necessary, but you might
want to clean your android artifacts with a cd android && ./gradlew
clean before trying to re-run your Android app.

Difficulties enabling Kotlin in React Native Expo with Bare Workflow

Saying that I've spent around 32 hours would be an understatement. I've been trying to enable Kotlin in a React Native project powered by Expo SDK 44.
I've been trying everything that I could find over the Internet, but it always ends up with an error in the Gradle Phase in EAS (Running it with eas build --profile development --platform android) .
Here are my configurations:
I'm omitting code for brevity. If you need more context, let me know
app\android\build.gradle:
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
kotlinVersion = "1.4.11"
}
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-plaid-link-sdk')
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
implementation 'androidx.core:core-ktx:1.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
// Other comed omitted
}
Here's my package.json
{
"name": "#pana/app",
"version": "22.0220",
"private": true,
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"eject": "expo eject",
"extract": "lingui extract",
"compile": "lingui compile",
"lint": "eslint src/** --ext .ts,.tsx",
"lint:fix": "yarn lint --fix",
"test": "jest",
"graphql:generate": "graphql-codegen --config codegen.yml",
"build": ""
},
"dependencies": {
"#apollo/client": "^3.5.10",
"#apollo/link-context": "^2.0.0-beta.3",
"#expo/react-native-action-sheet": "^3.13.0",
"#intercom/intercom-react-native": "^3.0.0",
"#lingui/react": "^3.13.2",
"#onfido/react-native-sdk": "^5.1.0",
"#react-native-async-storage/async-storage": "~1.15.0",
"#react-native-community/datetimepicker": "4.0.0",
"#react-navigation/bottom-tabs": "^6.3.1",
"#react-navigation/native": "^6.0.8",
"#react-navigation/stack": "^6.1.1",
"#reduxjs/toolkit": "^1.8.0",
"#segment/analytics-react-native": "^2.1.12",
"#segment/sovran-react-native": "^0.2.6",
"#sentry/react-native": "^3.2.13",
"axios": "^0.25.0",
"dayjs": "^1.10.8",
"expo": "~44.0.0",
"expo-application": "~4.0.1",
"expo-auth-session": "~3.5.0",
"expo-cellular": "~4.1.0",
"expo-clipboard": "~2.1.0",
"expo-constants": "~13.0.1",
"expo-crypto": "~10.1.1",
"expo-dev-client": "~0.8.5",
"expo-device": "~4.1.0",
"expo-document-picker": "~10.1.3",
"expo-image-loader": "~3.1.0",
"expo-image-picker": "~12.0.2",
"expo-linear-gradient": "~11.0.3",
"expo-local-authentication": "~12.1.0",
"expo-random": "~12.1.1",
"expo-secure-store": "~11.1.0",
"expo-splash-screen": "~0.14.1",
"expo-status-bar": "~1.2.0",
"expo-updates": "~0.11.7",
"make-plural": "^7.1.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-animated-progress": "^1.0.2",
"react-native-country-picker-modal": "^2.0.0",
"react-native-dotenv": "^3.3.1",
"react-native-gesture-handler": "~2.1.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-phone-number-input": "^2.1.0",
"react-native-plaid-link-sdk": "^7.4.0",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-shimmer-placeholder": "^2.0.8",
"react-native-svg": "12.1.1",
"react-native-uuid": "^2.0.1",
"react-native-web": "0.17.1",
"react-native-webview": "11.15.0",
"react-redux": "^7.2.6",
"semver-compare": "^1.0.0",
"sentry-expo": "^4.0.0",
"styled-components": "5.2.0",
"styled-system": "^5.1.5",
"validate.js": "^0.13.1"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#graphql-codegen/cli": "2.6.2",
"#graphql-codegen/typescript": "2.4.8",
"#graphql-codegen/typescript-operations": "2.3.5",
"#graphql-codegen/typescript-react-apollo": "3.2.11",
"#lingui/cli": "^3.13.2",
"#lingui/macro": "^3.13.2",
"#react-native-community/eslint-config": "^3.0.1",
"#types/jest": "^27.4.0",
"#types/react": "~17.0.21",
"#types/react-native": "~0.64.12",
"#types/react-native-animated-progress": "^1.0.0",
"#types/react-native-dotenv": "^0.2.0",
"#types/react-redux": "^7.1.23",
"#types/semver-compare": "^1.0.1",
"#types/styled-components": "^5.1.24",
"#types/styled-components-react-native": "5.1.0",
"#types/styled-system": "^5.1.15",
"#typescript-eslint/eslint-plugin": "^5.10.2",
"#typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.1.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"graphql": "^16.3.0",
"install-peers": "^1.0.3",
"jest": "^27.5.0",
"prettier": "^2.5.1",
"react-native-config": "^1.4.5",
"react-native-svg-transformer": "^1.0.0",
"remote-redux-devtools": "^0.5.16",
"ts-jest": "^27.1.3",
"typescript": "~4.3.5"
},
"jest": {
"preset": "react-native",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
},
"resolutions": {
"react-devtools-core": "4.14.0",
"#types/react": "17.0.21",
"#types/react-dom": "17.0.01"
}
}
Here's my folder structure:
Here's MyAppPackage.kt (android\app\src\main\java\com\pana\MyAppPackage.kt)
package com.pana // replace your-app-name with your appโ€™s name
import android.view.View
import com.facebook.react.ReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.ReactShadowNode
import com.facebook.react.uimanager.ViewManager
class MyAppPackage : ReactPackage {
override fun createViewManagers(
reactContext: ReactApplicationContext
): MutableList<ViewManager<View, ReactShadowNode<*>>> = mutableListOf()
override fun createNativeModules(
reactContext: ReactApplicationContext
): MutableList<NativeModule> = listOf(CalendarModule(reactContext)).toMutableList()
}
Here are some of the SO resources that I've resarched:
ERROR ----> Task :expo-permissions:compileDebugKotlin FAILED
React native android build is failing after configured kotlin-gradle-plugin, kotlin-android and kotlin-android-extensions
Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15
warning: Kotlin runtime JAR files in the classpath should have the same version
Android Studio shows Kotlin Dependency Warning after Second Build
Why do I have different versions of Kotlin JARs in the classpath?
flutter build Runtime JAR files in the classpath should have the same version. These files were found in the classpath
warning: Kotlin runtime JAR files in the classpath should have the same version
Installing Kotlin-Jupyter: e: java.lang.NoClassDefFoundError: Could not initialize class org.jetbrains.kotlin.com.intellij.pom.java.LanguageLevel
Here are some othe resources that I've looked into:
https://www.youtube.com/watch?v=wk_cR66AVXQ&t=114s
https://www.youtube.com/watch?v=GWcEVk7SgOg&t=44s
https://github.com/circleci/circleci-docs/issues/2945#issuecomment-471637158
https://developer.android.com/kotlin/add-kotlin
Here are some of the errors and fixes that I've tried:
1 - Minimal Incrementing the project to barebones Kotlin
I've tried minimally incrementing my current project (Note that I had to set the compileSdkVersion and targetSdkVersion to 31 for an Intercom package, and that is building successfully). I've followed this video,the official React Native Docs, and the Add Kotlin to an existing app with Android Studio (Manual Approach).
a. (android/build.gradle) Added (Inside buildscript.ext) kotlin_version = '1.4.10'
b. (android/build.gradle) Added (Inside dependencies) classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
c. (android/app/build.gradle) Added (at the top of the file) apply plugin: "kotlin-android"
Tried to compile:
[stderr] Note: Recompile with -Xlint:deprecation for details.
> Task :app:compileDebugKotlin FAILED w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
/home/expo/.gradle/caches/transforms-3/f47aaec93b5ce8275ab670559bc858c7/transformed/jetified-kotlin-stdlib-jdk8-1.5.31.jar (version 1.5)
/home/expo/.gradle/caches/transforms-3/e30ac7ea6364b484c3bc3c923afeabd2/transformed/jetified-kotlin-stdlib-jdk7-1.5.31.jar (version 1.5)
/home/expo/.gradle/caches/transforms-3/d9723caca13068e43e601371da49b5b2/transformed/jetified-kotlin-stdlib-1.6.10.jar (version 1.6)
/home/expo/.gradle/caches/transforms-3/c5966235c8aa66a583bf2afcd9edd1b7/transformed/jetified-kotlin-stdlib-common-1.6.10.jar (version 1.6) w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath [stderr] e: /home/expo/.gradle/caches/transforms-3/c5966235c8aa66a583bf2afcd9edd1b7/transformed/jetified-kotlin-stdlib-common-1.6.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.0.
2 - Pushing Kotlin to Version 1.6.10
Seeing this, led me to some research and suggested to push the Kotlin version to 1.6.10:
Task :expo-dev-launcher:compileDebugKotlin
[stderr] Compilation with Kotlin compile daemon was not successful
[stderr] java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
[stderr] java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
[stderr] java.io.InvalidClassException: org.jetbrains.kotlin.incremental.IncrementalModuleInfo; local class incompatible: stream classdesc serialVersionUID = 1, local class serialVersionUID = 0
[stderr] at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:391)
[stderr] at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
[stderr] at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
[stderr] at java.base/java.security.AccessController.doPrivileged(Native Method)
[stderr] at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
[stderr] at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
[stderr] at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
[stderr] at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
[stderr] at java.base/java.security.AccessController.doPrivileged(Native Method)
[stderr] at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
[stderr] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[stderr] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[stderr] at java.base/java.lang.Thread.run(Thread.java:829)
[stderr] at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:303)
[stderr] at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:279)
[stderr] at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:164)
This lead me to update to run expo upgrade and expo doctor to see if any of the updates would work. This opened Pandora's box. Upgrading to expo SDK 45 came with its own issues (apparently I have some conflicting packages that throw the following errors):
[stderr] Note: /home/expo/workingdir/build/app/node_modules/#sentry/react-native/android/src/main/java/io/sentry/react/RNSentryModule.java uses or overrides a deprecated API.
[stderr] Note: Recompile with -Xlint:deprecation for details.
> Task :app:compileDebugJavaWithJavac FAILED
[stderr] /home/expo/workingdir/build/app/android/app/src/main/java/app/pana/MainApplication.java:6: error: package android.app does not exist
[stderr] import android.app.Application;
[stderr] ^
[stderr] /home/expo/workingdir/build/app/android/app/src/main/java/app/pana/MainApplication.java:7: error: package android.content does not exist
[stderr] import android.content.Context;
[stderr] ^
[stderr] /home/expo/workingdir/build/app/android/app/src/main/java/app/pana/MainApplication.java:8: error: package android.content.res does not exist
[stderr] import android.content.res.Configuration;
[stderr] ^
[stderr] /home/expo/workingdir/build/app/android/app/src/main/java/app/pana/MainApplication.java:10: error: package android.webkit does not exist
[stderr] import android.webkit.WebView;
There were other builds that failed with the expo-dev-client. I'm also aware of a bug in the SDK 45 that you will have problems with Hermes enabled. We're using JSC.
3 - A bunch of other things
Just to prevent this question from becoming longer, here are other things that I've tried:
a. Changing the distributionUrl in the gradle-wrapper.properties to a more recent gradle version.
b. Updating, and mathcing the org.jetbrains.kotlin:kotlin-gradle-plugin (in android/build.gradle), org.jetbrains.kotlin:kotlin-stdlib-jdk7 (changed it to jdk8 and nothing), org.jetbrains.kotlinx:kotlinx-coroutines-core, org.jetbrains.kotlinx:kotlinx-coroutines-android, androidx.core:core-ktx with the corresponding kotlin versions.
c. Added these implementations inside a debugImplementation statement.
d. Researched React Native versions corresponding with Kotlin (Don't know if Version 0.64 which is Expo's SDK 44 supports Kotlin 1.6.10).
e. Checked for syntax errors using Android Studio.
f. Ran gradlew clean.
g. And other things...
Does anyone know anything? There doesn't seem to be anything reported in the Expo GitHub.
The following packagingOptions seems to help mitigate some of the issues
// android/app/build.gradle
android {
// This fixes a bug when
// https://github.com/facebook/react-native/issues/33120
packagingOptions {
jniLibs.useLegacyPackaging = true
}

REACT NATIVE Could not find com.google.firebase:firebase-iid:. New update from iid broke the project

Some info first: this is not my workstation, this notebook is owned by the company i work on, i do have some access.
Some things are weird with the enviroment, but we can work, I`m not the only one having problems with the enviroment, but i dont think this is related to env, but with the latest iid update.
The way i have to start the project is by two terminals where
the usage of sudo su is to prevent some bugs within our enviroment
1 > [sudo su] yarn react-native start
2 > [sudo su] yarn android:android:debug
which results in this error:
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not find com.google.firebase:firebase-iid:.
Required by:
project :app > project :#react-native-firebase_iid
**import info :#react-native-firebase_iid received an update as of yesterday july/07/2020
so before that all was working
follows the package.json file
"dependencies": {
"#react-native-community/async-storage": "^1.6.1",
"#react-native-community/netinfo": "^5.6.2",
"#react-native-firebase/analytics": "^6.1.0",
"#react-native-firebase/app": "^6.1.0", DOWNGRADING DID NOT HELP ( version bellow )
"#react-native-firebase/iid": "^6.3.4", DOWNGRADING DID NOT HELP ( version bellow )
"axios": "^0.19.0",
"native-base": "^2.13.1",
"prop-types": "^15.7.2",
"react": "16.8.6",
"react-native": "^0.60.4",
"react-native-barcode-builder": "^1.0.5",
"react-native-config": "^0.12.0",
"react-native-dialog": "^5.6.0",
"react-native-elements": "^1.2.0",
"react-native-flip-card": "^3.5.5",
"react-native-geolocation-service": "^3.1.0",
"react-native-gesture-handler": "^1.3.0",
"react-native-image-picker": "^1.1.0",
"react-native-keychain": "^3.1.3",
"react-native-map-link": "^2.5.1",
"react-native-maps": "^0.25.0",
"react-native-masked-text": "^1.13.0",
"react-native-screens": "^2.3.0",
"react-native-splash-screen": "^3.2.0",
"react-native-touch-id": "^4.4.1",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^3.11.1",
"uninstall": "0.0.0"
},
yarn list --pattern "#react-native-firebase" results in
yarn list v1.22.4
โ”œโ”€ #react-native-firebase/analytics#6.7.2
โ”œโ”€ #react-native-firebase/app-types#6.7.1
โ”œโ”€ #react-native-firebase/app#6.7.1
โ””โ”€ #react-native-firebase/iid#6.7.1
Done in 0.49s.
Following another questions similar to this problem gave me these options
rm -rf node_modules/
rm -rf yarn.lock
./gradlew clean
yarn react-native link react-native-firebase
yarn react-native start --reset-cache
tryng to sync the android project on android studio
IOS also having problems
following the iid instalation to react native from firebase
none worked, sadly
yarn react-native link react-native-firebase results in
$ /home/raiadrogasil.com/kamoraes/Workspace/ProjetosRd/univers-app-react/node_modules/.bin/react-native link react-native-firebase
warn The following packages use deprecated "rnpm" config that will stop working from next release:
- react-native-maps: https://npmjs.com/package/react-native-maps
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
error Unknown dependency. Make sure that the package you are trying to link is already installed in your "node_modules" and present in your "package.json" dependencies. Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.```
settings.gradle
rootProject.name = 'universAppReact'
include ':react-native-touch-id'
project(':react-native-touch-id').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-touch-id/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
apply from: file("../node_modules/#react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':#react-native-firebase_app'
project(':#react-native-firebase_app').projectDir = new File(rootProject.projectDir, './../node_modules/#react-native-firebase/app/android')
include ':app'
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.1")
classpath 'com.google.gms:google-services:4.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
}
}
the project stopped working after we tried a new clone, of the project ro resolve some issues.
please if there are needed any more info, do tell me.
Try to play with version of package. In my case i cleared the up arrow before the version and it worked. Don't worry after all i revert changes and all good.
"#react-native-firebase/iid": "6.3.4", DOWNGRADING DID NOT HELP ( version bellow )
"#react-native-firebase/iid": "^6.3.4", DOWNGRADING DID NOT HELP ( version bellow )

React-Native - react-native-update-gradle - Error

i had an error with my React-Native Project for Android.
My first error was the following:
I added the "react-native-location" Library. After i run the Command "react-native link", the error "compileOnly" was thrown.
So my first try was, upadate NPM and Node.JS.
But it wasnยดt the right solution for my Problem.
After that, i had google the Error and i want to update grandle with "react-native-update-gradle". My main Problem now is, when i run the "react-native link" command, i get the following error:
C:\Computer\Apps\Projects\XXX>react-native link
Scanning folders for symlinks in C:\Computer\Apps\Projects\XXX\node_modules (70ms)
rnpm-install info Platform 'ios' module react-native-orientation is already linked
rnpm-install info Platform 'android' module react-native-orientation is already linked
internal/validators.js:125
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:125:11)
at Object.join (path.js:427:7)
at getSDKPath (C:\Computer\Apps\Projects\XXX\node_modules\react-native-update-gradle\index.js:13:12)
at getPTPath (C:\Computer\Apps\Projects\XXX\node_modules\react-native-update-gradle\index.js:17:20)
at Object.activateADB (C:\Computer\Apps\Projects\XXX\node_modules\react-native-update-gradle\index.js:5:42)
at Object.<anonymous> (C:\Computer\Apps\Projects\XXX\node_modules\react-native-update-gradle\cli.js:101:6)
at Module._compile (internal/modules/cjs/loader.js:734:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
at Module.load (internal/modules/cjs/loader.js:626:32)
at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
C:\Computer\Apps\Projects\XXX\node_modules\react-native\local-cli\core\makeCommand.js:27
throw new Error(`Error occurred during executing "${command}" command`);
^
Error: Error occurred during executing "node ./node_modules/react-native-update-gradle/cli.js" command
at ChildProcess.prelink (C:/Computer/Apps/Projects/XXX/node_modules/react-native/local-cli/core/makeCommand.js:27:15)
at ChildProcess.emit (events.js:197:13)
at maybeClose (internal/child_process.js:978:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
I tried to fix the Error, but the error is still there.
I had the following Environments
Window 10
React-Native 0.55.4
React-Native-Cli 2.0.1
NodeJS v11.9.0
npm 4.6.0
android/build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com'
}
}
}
ext {
compileSdkVersion = 28
targetSdkVersion = 28
buildToolsVersion = "28.0.3"
supportLibVersion = "28.1.1"
playServicesVersion = "15.0.1"
}
package.json
{
"name": "XXX",
"version": "1.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"run-android": "react-native run-android"
},
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-image-slider": "^2.0.3",
"react-native-image-zoom-viewer": "^2.2.25",
"react-native-orientation": "^3.1.3",
"react-native-pinch-zoom-view": "^0.1.6",
"react-native-responsive-image": "^2.3.1",
"react-native-router-flux": "^4.0.0-beta.28",
"react-native-scrolltotop": "0.0.6",
"react-native-slideshow": "^1.0.1",
"react-native-swipe-gestures": "^1.0.2",
"react-native-update-gradle": "^1.1.0",
"react-native-vector-icons": "^4.6.0",
"react-native-zoom-view": "^1.0.2"
},
"devDependencies": {
"babel-jest": "22.4.3",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.3",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
}
If you need more information to help me, please tell me that.
Thanks for your help.
Best Regards
Hi Sebastian ! After you run the command react-native link, you have to run the command react-native run-android or react-native run-ios. So that the library you have installed adjusts to your react native settings. This is work for me, after I installed the library or package. hope this helps.

Task :react-native-firebase:compileDebugJavaWithJavac FAILED

I always encounter this error when I try to run my app on an android device. I followed the RNFirebase instruction step by step to add it to my existing project, but it just doesn`t work.
> Task :app:processDebugGoogleServices
Parsing json file: /Users/myname/Documents/myname/Programmierungen/Project/android/app/google-services.json
> Task :react-native-firebase:compileDebugJavaWithJavac FAILED
/Users/myname/Documents/myname/Programmierungen/Project/node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/perf/RNFirebasePerformance.java:50: error: cannot access zzf
promise.resolve(getOrCreateTrace(identifier).getAttribute(attribute));
^
class file for com.google.android.gms.internal.firebase-perf.zzf not found
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
FAILURE: Build failed with an exception
It works fine with ios, just compiling for android does not work.
My /app/build.gradle dependencies: (Yes, I did add the apply plugin at the very bottom)
implementation project(':react-native-firebase')
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.google.firebase:firebase-core:16.0.3"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
The android/build.gradle-dependencies:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
and allprojects:
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
Other useful information:
"dependencies": {
"babel-preset-react-native": "^4.0.0",
"react": "16.5.0",
"react-native": "^0.57.1",
"react-native-firebase": "^5.0.0"
},
"devDependencies": {
"#babel/core": "^7.1.2",
"#babel/runtime": "^7.1.2",
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.47.0",
"react-test-renderer": "16.5.0"
},
"jest": {
"preset": "react-native"
}
I`m coding on macos Mojave with Java 8.
Thanks for helping!! ':D

Categories

Resources