I had a working React app released for Android and iOS via Capacitor. But now with a new version of my app, builds were not working with the Pixel 4 API 29 virtual device I used previously. Retrying with a Pixel 2 API 28 builds complete and the app opens, but now Mapbox is no longer loading and that is the core of my app. I updated to Android Studio 4.2.1 and have the following as dev dependencies in my package.json:
“#capacitor/android”: “^3.0.2”,
“#capacitor/cli”: “^3.0.2”,
“#capacitor/core”: “^3.0.2”,
“capacitor-resources”: “^2.0.5”,
“cordova-res”: “^0.15.3”
Small elements of my app are accessing the web, so it doesn’t seem to be an internet access issue. The main changes I’ve made in this version are upgrading to Mapbox 2.3.0 and making basic use of cookies for user settings, but not for ad tracking. But I’ve reverted both of these changes and the problem is persisting so it doesn’t seem to be because of the new Mapbox version or because the introduction of cookies.
Getting errors like this where the last letter of the app name is missing for some reason:
E/o.ionic.ecorat: Invalid ID 0x00000000.
Invalid ID 0x00000000.
E/o.ionic.ecorat: Invalid ID 0x00000000.
Also errors like this:
E/cr_VariationsUtils: Failed reading seed file “/data/user/0/io.ionic.ecorate/app_webview/variations_seed”: /data/user/0/io.ionic.ecorate/app_webview/variations_seed (No such file or directory)
Do errors like this mean that the app isn’t detecting that it’s meant for prod?
E/Capacitor/Console: File: http://localhost/static/js/2.9b5092bb.chunk.js - Line 2 - Msg: Error: Failed to initialize WebGL
E/Capacitor/Console: File: http://localhost/static/js/2.9b5092bb.chunk.js - Line 2 - Msg: Uncaught (in promise) Error: Failed to initialize WebGL.
I use ternary operators that start like this:
const url = process.env.NODE_ENV === ‘production’ ?
to decide whether to go to the real website or use localhost.
Should I go back to a more stable version of capacitor?
There are 3 things I can suggest which worked for me..
Check the devtool and inspect the emulator. if you see a error something like this
Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH
Then you can use npx capacitor run which should solve the issue, this is a quick fix though.
Replace your dev-flow and start using npx instead of ionic XXXX commands.
If you wish to update the deps and dev-deps in that case, based on package.json you have shared in your question you are missing a few plugins.
if you were to create a new ionic app using ionic start then the package.json will look something like this [ignore the vue deps]
"dependencies": {
"#capacitor/android": "3.0.2",
"#capacitor/app": "1.0.2",
"#capacitor/core": "3.0.2",
"#capacitor/haptics": "1.0.2",
"#capacitor/keyboard": "1.0.2",
"#capacitor/status-bar": "1.0.2",
"#ionic/vue": "^5.4.0",
"#ionic/vue-router": "^5.4.0",
"core-js": "^3.6.5",
"vue": "^3.0.0-0",
"vue-router": "^4.0.0-0"
}
So, you will need to manually install the package apart from #capacitor/android & #capacitor/core I believe these packages that are de-coupled packages that makes capacitor lighter than the prev version and need to be manually installed.
After that you need to build using ionic build then use ionic open to open the IDE and sync the project with Gradle for the android app. Once this is done you can use ionic capacitor run --livereload --external to open the emulator and the dev server with live-reload..
Related
The package in question is
react-native-peripheral
and per there documentation. it only supports IOS. I'd still like the rest of the application to work on android devices, since that feature is only on one page that doesn't even render for Platform.OS === "android"
However, gradlew clearly insists that the module must be defined...
here's a simple example if you want to bootstrap an expo project and add the module yourself
if (Platform.OS === "ios") {
Peripheral= require("react-native-peripheral").default
}
but you'll be greeted with the following error
Unable to resolve module react-native-peripheral
or
A problem occurred evaluating project ':react-native-peripheral'.
Let me know if anyone knows how to handle this edge case.
I have a mobile app with React Native and works without any problem. I wanted to add notification functionality to that app.
I installed firebase/app, firebase/messaging and #notifiee for being able to send notifications. After installed these packages, I am able to build my app on android emulator but i'm getting error on the console like this:
ERROR Error: Notifee native module not found.
LOG Running "myMobileApp" with {"rootTag":1}
ERROR Invariant Violation: "myMobileApp" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
I'm using Visual Studio Code, Android Studio Emulator and JDK 11 on an Ubuntu 20.04.4 LTS.
Relevant packages in my package.json:
"dependencies": {
...
"#notifee/react-native": "^5.3.0",
"#react-native-firebase/app": "^14.11.0",
"#react-native-firebase/messaging": "^14.11.0",
"react": "16.13.1",
"react-native": "0.63.4",
...
},
stop your project, close the running terminal window and on your android studio press on the "sync project with gradle files" icon, you can find it on the top bar behind the device manager
re-run your project
work for me
if you are using ZEGOCLOUD videocalling .
compileSdkVersion = 33 // <----- change this in android/build.gradle
I've been trying to run my react native application, but it crashed when started and the debugger didn't return any error, so I checked the log cat in Android Studio and it shows me the following error: java.lang.NoClassDefFoundError: Failed resolution of: Lcom / google / firebase / iid / FirebaseInstanceId;
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceId"
The React-Native version that I am using is: 0.61.5
And the version of react-native-firebase that I have installed is 5.6.0
It has already been a recent failure, since previously the app worked correctly and I have not made any changes to the firebase integration either
To debug this, first I would suggest running adb logcat and seeing what Java error you are getting. If it errors out on the not being able to find the required Java classes, then try adding the following to your project:
app/build.gradle file (dependencies section):
implementation 'com.google.firebase:firebase-iid'
(You might need to provide a version for this package as well)
I have getting same error, I fixed this error by uninstalling old version and installing new version of push notification.
uninstall:
npm uninstall react-native-push-notification
install:
npm i react-native-push-notification
since react-native-push-notification upgraded to new version v7.x so that, while installing app it give above error.
checkout this -> https://www.npmjs.com/package/react-native-push-notification
There is an issue, in react-native-push-notification (FirebaseInstanceId has been deprecated and now removed). Sounds like you are using a lib that is using that that here. It should be fixed later on, but for now you can add the following to your android/build.gradel file.
buildscript {
ext {
...
firebaseMessagingVersion = "21.0.0"
}
I had also to update these libs (you will get compile errors if you don't, so you may have others to update):
- "react-native-device-info": "^5.5.8",
+ "react-native-device-info": "^8.1.3",
- "react-native-push-notification": "^7.3.0",
+ "react-native-push-notification": "^7.3.1",
This is in reference to this issue
wix/react-native-notifications
This lib having issue with refreshToken() Method.
Didn't find class "com.google.firebase.iid.FirebaseInstanceId"
so just remove / reinstall the package, if still error is coming then we have to wait for next bug fix release of this lib or
we can manually change native code to make it working.
below is link of lib
https://github.com/wix/react-native-notifications/issues?q=FirebaseInstanceId
I am developing apps with Cordova.
I have build an app and when calling this in cli cordova run android --device
it's deploying my app on the device. While debugging on chrome I get:
module org.apache.cordova.file.File not found
Why is that ?
In my config.xml file I have the following:
<plugin name="cordova-plugin-file" version="3.0.0" />
and the plugin is located in cordova\platforms\android\platform_www\plugins
The cordova version is 4.1.1.
What is the difference in these below ?
org.apache.cordova.file.File
org.apache.cordova.file
Consolelogs
xxxx.$application::launch()
file:///android_asset/www/resources/ext-watermark/fonts/ext-watermark.woff?n6lnws Failed to load resource: the server responded with a status of 404 (Not Found)
file:///android_asset/www/resources/images/favicon.ico Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///android_asset/www/resources/ext-watermark/fonts/ext-watermark.ttf?n6lnws Failed to load resource: the server responded with a status of 404 (Not Found)
app.js:1 ::::Cordova DeviceReady::::
app.js:1 Require: org.apache.cordova.inappbrowser.inappbrowser
app.js:1 Require: org.apache.cordova.file.File
cordova.js:59 Uncaught module org.apache.cordova.file.File not found
For me this issue was arising because of dependent plug-in i.e. org.apache.cordova.media-capture
If you have media-capture plugin installed, you would see inside org.apache.cordova.media-capture.MediaFile.js file there is the file dependent code
var utils = require('cordova/utils'),
exec = require('cordova/exec'),
File = require('org.apache.cordova.file.File'),
CaptureError = require('./CaptureError');
Solution:
I have removed the media-capture plugin for now and looking for an update which doesn't ask for old cordova file plugin API.
cordova plugin rm org.apache.cordova.media-capture
I understand that it wouldn't solve your problem completely, but you should be good to go ahead.
Thanks.
I had the same problem. I saw that although I added a newer version of cordova-plugin-file Cordova still used an older version. Removing /platforms and rerunning cordova platform add android did the trick
I am trying to integrate facebook using Plugin-x in cocos2d-x v3.5. I followed the following steps:
cd to MyProject/cocos2d/plugin/tools/
./publish.sh - on cygwin all the plugins get published one by one, for eg consider this Flurry trace
atarget dir is /Users/Shivam/Documents/Gautam/FinalWorkingApp/cocos2d/plugin/publish/plugins/flurry
android project dir is /Users/Shivam/Documents/Gautam/FinalWorkingApp/cocos2d/plugin/plugins/flurry/proj.android
Publish plugin for android
~/Documents/Gautam/FinalWorkingApp/cocos2d/plugin/plugins/flurry/proj.android ~/Documents/Gautam/FinalWorkingApp/cocos2d/plugin/tools ~/Documents/Gautam/FinalWorkingApp/cocos2d/plugin/tools
BUILD SUCCESSFUL
Total time: 0 seconds
BUILD FAILED
/Users/Shivam/Documents/Gautam/android-sdk-macosx/tools/ant/build.xml:542: Unable to resolve project target 'android-7'
Total time: 0 seconds
cp: /Users/Shivam/Documents/Gautam/FinalWorkingApp/cocos2d/plugin/plugins/flurry/proj.android/bin/*.jar: No such file or directory
~/Documents/Gautam/FinalWorkingApp/cocos2d/plugin/tools
~/Documents/Gautam/FinalWorkingApp/cocos2d/plugin/tools
All the plugins get published in the similar manner. I don't have android API 7, because of which it is failing, so can this be the reason my libpluginProtocol.jar is not getting generated?
I see a proper structure under under MyProject/cocos2d/plugin/publish/plugins
I also used gameDevGuide.sh and selected facebook.
Still I don't see libPluginProtocol.jar and libPluginFacebook.jar.
Please help. TIA
Ok so I found the answer. the library gets generated only when you have all the Android APIs viz, 7,8,10,17 and 19 apart from your own target APIs