I have an app in React Native, version 0.69.7, and it has stopped working. The build builds successfully and the application opens but nothing is displayed.
I downgraded to version 0.68.5 and it worked again, but when the upgrade is done again to version 0.69 or higher, the same thing happens.
I upgraded following the React Native Upgrade Helper.
Metro Bundle also does not display logs, and no internet connection related operations work within the app.
Note: The black screen in the print is where an update via Codepush should happen, but it hangs there due to the app not being able to make the request.
This problem only happens on Android.
Any idea what could be causing this?
Environment:
React Native: 0.69.7
OS Version: 10.0.0
OS: Android
Gradle Plugin Version: 7.1.1
Gradle Version: 7.3.0
JDK Version: 10.0.16
JRE Version: 1.8.0_341
Related
I'm stuck on pop-up splash screen with the loading progress indicator at 100%
I had Android Studio 4.2 Canary 16 previously installed and updated the Kotlin Plugin from 1.4.10 to 1.4.21. After installing the new version of the plugin I closed and restarted Android Studio which then crashed with error saying that the previous version of the Kotlin plugin failed to be uninstalled.
Subsequent restarts would then always crash Android Studio right before loading my Project.
I then uninstalled both the stable and canary(unzipped folder) Android studio programs and followed the steps as per How to completely uninstall Android Studio from windows(v10)?
I then reinstalled the latest Canary build - Arctic Fox 2020.3.1 and then the previous 4.2 Canary 16 but got the same issue on both versions getting stuck in the splash loading screen.
However installing the latest stable 4.1.1 build seems to work just fine. But I need to use the Canary builds to program Jetpack Compose Projects.
Is the canary build generating different files that the stable build does not? If so can I delete them to create to set up a fresh re-install?
This sounds to me alike a file-system permission or exclusive access issue:
the previous version of the Kotlin plugin failed to be uninstalled
You probably have to manually remove some leftovers from the previous install; on Windows these files are literally distributed all over the place. This may even be required when upgrading stable builds, as I recently had it with the "Fabric for Android Studio" plugin. Launching from the command-line might provide some more clue where it gets stuck (with high probability, when scanning the plugin directory). I've just checked; the Jetbrains Toolbox doesn't even uninstall old versions; %USERPROFILE%\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio (may vary) is where to find the plugins and where to check for file-system permissions. Also make sure, that the desktop shortcut actually points to the one version to run - or try to run studio64.exe directly.
Whats the issue?
I get a version mismatch on react native (android).
React Native version mismatch. JavaScript version: 0.59.9 - Native version: 0.63.4
The build works as described in this issue when running through Android Studio. The build however works fine when running: react-native run-android.
Please let me know what else I can try, or what might cause the issue.
React Native version: 0.63.4
Expected Results
The app running as expected
What have I tried to resolve the issue
Clearing caches
Forcing versions through build.gradle
(React Native version mismatch)
Going back in history through git
Reinstalling / trying other emulator versions
Remove node_modules and reinstall
Tried react-native-clean-project
(https://github.com/pmadruga/react-native-clean-project)
Uninstalling
the app from the emulator manually
Was building with SDK Tools 29, also tried with 30 (was working with 29 before)
Tried different versions of Android Studio (4.1, 4.0, 4.1.1. (current))
Tried downgrading to RN 0.62.2
Tried downgrading to RN 0.63.3
Console Error
My "nuclear" option that usually works is to just delete the entire repo from my local machine and then pull it back down from the cloud and start completely fresh.
Definitely not ideal, but sometimes literally nothing else works. I'm not even sure what causes this error as it just appears out of the blue and usually I haven't upgraded react-native for months or even years before it decides to show up.
Are you using a library (3rd party) that is using a react-native version different than your project's react native version?
in my case i was using react-native-v8 in my project and upon upgrading my rn project's version i got this error, so i matched the versions in the correct way.
here is the link for more info, i guess these problems have a similar source.
React Native version mismatch
I build a simple ionic project from this tutorial.
It runs on Xiaomi Mix 2 phone (android version 8.0.0) and on browser without any problem.
But when I deployed to the samsung note 2 (android version 4.4.2),
it gives an application error with this message:
net::ERR_CONNECTION_REFUSED (http://localhost:8080)
Why am I getting this error?
Any advice and suggestions will be appreciated.
Kemal.
I faced the same problem in Android 4.4, Android 6.0 but not in Android 8.0. I just added this code in config.xml to allow the localhost.
<allow-navigation href="http://localhost:8080/*"/>
For more information please follow this link:
WKWebView
Your problem is caused by the cordova-plugin-ionic-webview plugin that is part of every new or updated Ionic app.
This used to apply only to iOS, where it replaced the UIWebView with WKWebView, but on July 23rd 2018 they released version 2.0 of the plugin, that also included changes to the webview used on Android.
The Android webview now uses a local webserver at localhost:8080 to show your app instead of requesting the files directly from the file system.
Unfortunately this change also included this bit in the documentation:
Requirements
- […]
- Android: Android 5.0+ and cordova-android 6.4+
So cordova-plugin-ionic-webview just doesn’t support Android earlier than 5.0 any more, which of course means your app will not work on Android 4.x.
One solution is to downgrade the plugin to the last version that supported Android 4.x:
ionic cordova plugin add cordova-plugin-ionic-webview#1.2.1
More elaborate information and alternative solutions:
https://ionic.zone/debug/ionic-and-android-4
In case anyone is still not able to resolve this error,
Find the compatible webview version which works for you and run the below commands:
cordova plugin rm cordova-plugin-ionic-webview
cordova plugin add cordova-plugin-ionic-webview#4.1.3
In case you're using ionic, install the ionic plugin wrapper. (Skip this if your project is not an ionic project)
npm install #ionic-native/ionic-webview
Finally do clean installation of the platform and plugins. Delete
the plugins folder and run the following commands:
cordova platforms remove android
ionic cordova build android
Or, if you use ionic,
ionic cordova platforms remove android
ionic cordova build android
Additional information: Plugin version cordova-plugin-ionic-webview#4.1.3 worked for me for the below cordova and android versions:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : android 8.1.0
Android target : android-28
Android SDK Tools : 26.1.1
cordova-android : 8.1.0
You are getting the error because every function and module in Android only works from a certain version on newer. It could be 4.4.3 and up, 5.0 and up, or even 8.0 and up. It just depends. This means if and when you deploy it you will be required to select a minimum version. There is nothing you can do to fix it other than trying on a newer version. You can also change the code completely to work with older modules.
I've had same error even on new devices. After that, I've reinstalled cordova-plugin-ionic-webview plugin. Reinstallation upgraded plugin from 4.0.0 to 5.0.0 and added new line to config.xml:
<allow-navigation href="http://localhost:8100" sessionid="f8f1cc34" />
I'm still waiting for review, but hope this will help.
I had this problem for days and all the solutions I found did not work.
Ionic recommends using Capacitor to build the app and not Cordova. With Cordova does not work, on the other hand with Capacitor it works fine.
In your app directory first delete the Android folder (if any) and the one in Platform / Android folder.
I used these commands in this order launched by Powershell while staying in the APP directory
ionic build
ionic capacitor add android
npx cap open android
The first command will create a www folder.
If the last command give an error and does not open Android Studio, do it manually, (I recommend using 4.0 version). Open Android Studio → open folder, navigate to the folder named Android located in the folder in your APP and then it worked for me. In Android Sudio 4 make sure you have Gradle updated and the SDK loaded.
/android/CordovaLib/src/org/apache/cordova/engine/SystemWebViewClient.java
onReceivedError(WebView view, WebResourceRequest request,
WebResourceError error) {
super.onReceivedError(view, request, error);
if (error.getErrorCode() == WebViewClient.ERROR_CONNECT) { //net::ERR_CONNECTION_REFUSED
view.goForward();
return;
} else {
errorMessage();
}
}
To increase compatibility with older Android devices (4.0+) for my Cordova App I am wanting to use the Crosswalk Webview instead of the device webview. I am using Cordova Tools (CLI 6.3.0) for Visual Studio (2015 - Update 3) and have added the Plugin "Crosswalk WebView Engine" using the plugins panel in the config.xml. However, when I start up the app, debug it and inspect the useragenet (using "navigator.userAgent" from the console) it is not reporting as running using the Crosswalk WebView Engine.
Now I have heard some people suggest that you remove the Android platform, install the plugin and then rebuild, but that isn't fixing it for me. Perhaps I am removing the Android platform incorrectly? (I am just deleting the folder from disk).
Is this a case of my build steps being incorrect? Any assistance would be appreciated.
After persisting with this problem, assuming it to be a problem with my set-up, I got it working.
The key was to update everything. I installed the latest Java JDK (v1.8) - Updated mt CLI version to 6.5.0 - Installed any updates using the Android Update Manager (I also updated some files within Android Studio itself) and then finally installed Crosswalk (2.3.0).
Works like a dream now.
I have recently upgraded Cordoova to version 6 with android platforms 5.1.0 and ios 4.0.1 in one of the projects.
After also upgrading all plugins to the latest version the app is finally working again as it should.
However, I have noticed one very annoying difference:
With the old version when I ran the command:
cordova build android
it was compiling the app and installing it on the phone. However, it kept all the "data" from the previous version. So for example localStorage or SQLite database remained available.
When I run the same command under the new version, it replaces the app, removing all of it's "data".
As the app has a "setup process" I will now need to complete this every time I deploy a new version to the phone for testing, which is quite time consuming.
Is there any settings available to change this behavior?
I already checked the change log from Cordova but could not find any evidence what they have changed...
This issue was related to a bug in cordova, which got fixed with the latest release on March 2nd.
To fix it I did:
npm install -g cordova
cordova platform update android#5.1.1
details about the issue:
https://issues.apache.org/jira/browse/CB-10157
So in case you face a similar issue try to update your project - it worked just fine for me.