React Native Android error in com.facebook.react.bridge.NoSuchKeyException - android

I'm getting an error caught by Crashlytics and it's happening to almost 45% of the users but it doesn't seem to happen when the user is using the app but when it's in the background.
The stacktrace shown on Crashlytics is:
Fatal Exception: com.facebook.react.bridge.NoSuchKeyException ReadableNativeMap.java:124
lineNumber
I have no clue what can be causing this issue, if it's a Javascript error or a native library error

This is a problem caused by the stacktrace-parser library which is used internally by react native. Basically, release 0.1.4 works fine while releases 0.1.5 and 0.1.6 causes the lineNumber error.
Do the following to fix this:
If you are using yarn add the following to your package.json:
"resolutions": {
"stacktrace-parser": "0.1.4"
},
if you are using npm add the following to your package.json:
"dependencies": {
...
"stacktrace-parser": "0.1.4"
Remove the yarn.lock (or package-lock.json) file and the node_modules directory.
Install the packages yarn install (or npm install)
Rebuild your release build.
I hope this helps others until the library gets fixed.

My solution was to remove every console.error in my project.
https://github.com/facebook/react-native/issues/24382

Make sure "backgroundColor" value is never null or undefined. In my case that was the reason.

It ended up being an issue with some native library that was causing the crash. Simply upgrading it solved the problem

Related

Flutter: Error: The method 'File.create' has fewer named arguments than those of overridden method 'File.create' [duplicate]

When I try to run my Flutter project, I get errors like:
../../../.pub-cache/hosted/pub.dev/file-6.1.2/lib/src/interface/file.dart:15:16: Error: The method 'File.create' has fewer named arguments than those of overridden method 'File.create'. Future create({bool recursive = false});
Running flutter clean and flutter upgrade didn't help. What's wrong? How do I fix this?
I kept getting the same error, But I solved it adding by adding
file: ^6.1.4 in my dependencies
If you are having the same problem. Make sure you have the latest file dependency.
I think the problem is caused by an outdated reference to file dependency. See this issue.
For fix this, on the project or library folder run:
dart pub upgrade
This command will upgrade your dependencies and the problem will be solved without adding the reference to latest version of file dependency.
I just ran in to this issue and I was on flutter's master channel. I switched back to stable (flutter channel stable) and everything works fine.
For me the packages in my pubspec.yaml were all up to date, but the following fixed it:
Delete pubspec.lock.
Run flutter pub get again.
i solved it by adding file: ^6.1.4 to my pubspec i dont know why this is needed in dependenccies but when i added it worked
this error occured to me when i was trying to update my flutter and packages
but error thrown was of transitive dependencies i guess when u defin in dependencies it over rides the transitive one
but it worked for me
but after wards once project ran i removed the file dependencie from my punspec did a flutter clean and a pub get again and ran the project again it worked without any problem

Why is my react navigation not working on android?

Recently I merged some changes from a colleague and these changes have React Native Navigation setup in it. After installing all the dependencies and setting up everything, When I run the app, I get this error that says
com.app.MainActivity cannot be cast to com.reactnativenavigation.NavigationActivity
Apparently, the error is coming from the following file
react-native-navigation\lib\android\app\src\main\java\com\reactnativenavigation\react\NavigationModule.java
How to reproduce
I am not really sure how to reproduce this error because I don't know what's causing it in the first place. However, the only other unexpected behavior was that my Android Studio or react-native run-android both were failing gradle build when I first added all the required dependencies. The reason for failure was kotlin-android and even though I can confirm that from the build.gradle files of the repository that the required settings exist, still I had to add the relevant required config to my main applications android/gradle.build and android/app/gradle.build
Apparently this solved the issue with now react-native run-android running successful gradle build.
The repository has the following dependencies config
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
Despite the presence of above, my gradle builds were failing and complaining about android-kotlin so I added the following dependencies config to my app's android/gradle.build
classpath('com.android.tools.build:gradle:3.6.2')
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
Notice the difference in versions of the gradle (This gradle version came by default with RN 0.62) and kotlin-gradle-plugin. I don't know, but could this be the cause of the issue?
I am using latest version 5.5.1 for #react-navigation/native
I finally figured this out. Actually the problem was being caused by another package that was just added to the project and wasn't setup and being used. The package that was causing the issue was https://github.com/wix/react-native-navigation which I didn't notice it was there and it apparently wasn't properly configured.

Program type already present: androidx.versionedparcelable.NonParcelField

i am working on a react native android project but i am stuck on this error
> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: androidx.versionedparcelable.NonParcelField
FAILURE: Build failed with an exception.
i have tried to change multi dex to false in build.gradle
defaultconfig {...
multiDexEnabled false
...}
i dont want to migrate to androidx , i just want to get rid of androidx & this error ;
please help me , thanks in advance
Based on my research couldn't not find an easy way or should I say a correct way to draw back from androidx, to solve the above issue just add the following to your gradle.properties
android.useAndroidX=true
android.enableJetifier=true
That might cause another issue like
Execution failed for task
':react-native-navigation:compileReactNative57_5DebugJavaWithJavac'
the reason of this error, if it occured, after migrating your android project to androidx, many of your react-native libraries ship native Java code and have not been updated, updating it manually is tedious, I was able to do so by using this library jetifier simply by running
npm i --save-dev jetifier
npx jetify
In my case there were still some libraries causing some issues such us react-native-fast-image, as a workaround, I created a gradle.properties inside /node_modules/react-native-fast-image/android and deactivated AndroidX and Jetifier for this module:
android.useAndroidX=false
android.enableJetifier=false
The answer that Ahmed posted is a great solution once you've migrated to AndroidX. In my case I found out that only one library in my application was using AndroidX from this thread
In short my solution was to simply yarn upgrade react-native-device-info#latest The app build as expected after rebuilding it
Please follow the following steps:
Open Android Studio
Click on Refactor on the top menu bar
Click on Migrate too AppCompat
I hope this shall help you
I ran into a similar problem: I'm updating an app for RN 0.60.0. In my case, I had a dependency in build.gradle with a '+' in its version, and that particular dependency got updated, which broke my build.
In my case, explicitly specifying the version number resolved my problem.
./gradlew app:dependencies will show a tree of your dependencies; this might point you in the right direction as well.

Crashlytics Generate Symbols task got stuck

Trying to Generate symbols for crashlytics using
./gradlew crashlyticsGenerateSymbolsDebug.
But this process get stuck, even with --debug there is no logs.
Any idea why this is happening?
Mike from Fabric here. This was a bug introduced in 1.24.3 of the Fabric Gradle plugin. It's been fixed in 1.24.4.
The same problem happened to me today when trying to build a release APK of a project I work on.
Like Alkaiser mentioned, it seems to be a problem with the Fabric tools.
Just open the following URL to see the available Fabric tool versions:
https://maven.fabric.io/public/io/fabric/tools/gradle/maven-metadata.xml
And then go to the project level Gradle file, and change the io.fabric.tools classpath to use an earlier version - 1.24.2 should solve the problem.

Ionic plugin barcodescanner

When I try to build the application "ionic build android" see the error below. This error only happens when I install phonegap-plugin-BarcodeScanner.
Anyone know what can this be?
Error: error code 1 for command: /path/to/app/platforms/android/gradlew with args: cdvBuildDebug, -b, /path/to/app/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
Mostly this error happens because the gradle version of your project and the gradle version of a plugin is missmatching.
What you can do is removing the platform and add it again.
Open the project and deny the question from AndroidStudio to upgrade to the newest gradle version.
I think that the problem was solved.
What I did was remove a line from myapp-barcodescanner.gradle file.
This is the code removed:
compile 'com.android.support:support-v4:+'.
Now, it is working normally.

Categories

Resources