I created a new cordova project with angularjs with ng-cordova and ionic from a command-line.
I'm able to open this project with IntelliJ, but I must launch the app with a commandline :
cordova run android
The problem is that I don't have any logs, I don't have any log console.
How should I do to see a console log ?
Thanks
Just add the following plugin:
cordova plugin add org.apache.cordova.console
& then type console.log('123');
You would be able to see console logs in 'android monitor'
Related
I have added firebase plugin to cordova for push notification. When I try to create android app using command "cordova platform add android" I am getting error message saying failed to install 'cordova-plugin-firebase' and can any one please suggest me how can i fix this issue.
Change your android version. This solved for me.
cordova platform
cordova platform rm android
cordova platform add android#version_number
I installed the following lines below:
ionic cordova plugin add cordova-plugin-facebook4
install #ionic-native/facebook
npx cap sync android
It generates a folder plugins/cordova-plugin-facebook4
But when I run the codes in the android studio emulator it always return
common.js:267 Native: tried calling Facebook.login, but the Facebook plugin is not installed.
common.js:279 Install the Facebook plugin: 'ionic cordova plugin add cordova-plugin-facebook4'
I think the folder plugins did not copy to the android folder, any help thank you
You have to install the packages like this..
npm install #ionic-native/facebook
npm install cordova-plugin-facebook4
ionic build
npx cap sync android
then, follow these steps..
In android studio, go to app -> res -> values -> string.xml
add the following lines in resources
<string name="fb_app_name"> YOUR FB APP NAME </string>
<string name="fb_app_id"> YOUR FB APP ID </string>
To understand the last step, follow this tutorial, it is a bit outdated, but nevertheless great effort and explains a lot.
To use the FB plugin, you first have to create a new Facebook App inside of the Facebook developer portal
see this link: https://ionicframework.com/docs/native/facebook
and this for mor infos https://github.com/jeduan/cordova-plugin-facebook4
I just created a new app with the next command:
ionic start myapp
Everything works fine but when I try to deploy to Android (My Android studio environment is properly installed and configured), I get the next error:
Error: Failed to fetch plugin cordova-plugin-statusbar#https://github.com/apache/cordova-plugin-statusbar.git
via registry.
I try to deploy with:
ionic cordova run android
Thanks in advance.
This work for me, If the other solutions did,t work
cordova plugin add https://github.com/apache/cordova-plugin-statusbar.git
I found the solution. Just run this command:
cordova plugin add cordova-plugin-statusbar
Now I can deploy my app but I don't know why that plugin is not installed automatically.
Cant seem to follow the tutorials for building apps with Mobile first and cordova.
i used mfp cordova create to create an app and named it Idealaketest.
Enter name of app: Idealaketest
Enter the package ID: com.ibm.Idealaketest
have progressed on as far as the code below.
Please help with a workaround or a link to a page with appropriate tuts.
I'm following this at the moment.
https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/hello-world/integrating-mfpf-sdk-in-cordova-applications/
D:\Mobilefirst_workspaces\workspace3>mfp cordova create
? Enter name of app: Idealaketest
? Enter the package ID: com.ibm.Idealaketest
? Enter the app version: 1.0.0
? Select platforms to be supported by your app: android
? The following plugins will be automatically added to your app:
cordova-plugin-mfp
org.apache.cordova.device
org.apache.cordova.dialogs
org.apache.cordova.geolocation
org.apache.cordova.globalization
org.apache.cordova.inappbrowser
org.apache.cordova.network-information
Please press enter to continue...
? Select additional plugins you would like to add:
? Enter a path to an app template to be added: cordova-hello-world-mfp
Embedded Cordova Command: cordova create "Idealaketest" "com.ibm.Idealaketest" "
Idealaketest" --copy-from="C:\Program Files\IBM\MobileFirst-CLI\mobilefirst-cli\
node_modules\cordovacmd\cordova\templates\cordova-hello-world-mfp"
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.ibm.Idealaketest
Name: Idealaketest
Android target: android-22
Copying template files...
Project successfully created.
Adding "cordova-plugin-mfp"
Installing "cordova-plugin-mfp" for android
Installing "org.apache.cordova.device" for android
Installing "org.apache.cordova.dialogs" for android
Installing "org.apache.cordova.geolocation" for android
Installing "org.apache.cordova.globalization" for android
Installing "org.apache.cordova.inappbrowser" for android
Installing "org.apache.cordova.network-information" for android
Plugin install completed
CordovaApp.java was renamed to MainActivity.original, if you made manual changes
to CordovaApp.java, you need to merge them with the current main activity file,
CordovaApp.java, in /platforms/android/src/[package_path]
Plugin "cordova-plugin-mfp" added successfully.
Preparing for push...
MFP App settings not found, configuring..
Embedded Cordova Command: cordova prepare android
D:\Mobilefirst_workspaces\workspace3\Idealaketest\mobilefirst\com_ibm_Idealakete
st-android-1.0.0.wlapp has been built.
Push Completed Successfully.
MFP Cordova project created successfully.
D:\Mobilefirst_workspaces\workspace3>mfp start
Cannot find the server configuration. Creating a new MobileFirst test server.
The development server is being created.
The development server has been successfully created with the following informat
ion:
Server Directory: C:/Users/guest/.ibm/mobilefirst/7.1.0.00.20160307-2032/server
/
URL: http://localhost:10080/
Error: You must be in a MobileFirst project to execute this command.
D:\Mobilefirst_workspaces\workspace3>cd Idealaketest
D:\Mobilefirst_workspaces\workspace3\Idealaketest>mfp start
Error: You must be in a MobileFirst project to execute this command.
D:\Mobilefirst_workspaces\workspace3\Idealaketest>mfp cordova preview
? Select how to preview your app: browser: Simple browser rendering
Preparing for push...
Verifying Server Configuration...
Error: There are no runtimes available on this server.
Run 'mfp help intro' for guidance.
Error: error code: 305
Error: There was an error with the server.
Error: MASTERPUSHSERVERFAILED
Error: Push has failed
You didn't a project...
Create the project:
mfp create myproj
cd myproj
mfp start
Create the Cordova project:
cd ..
mfp cordova create myapp
cd myapp
mfp cordova platform add android
mfp push
mfp cordova run
The Crashlytics say we need to download the Fabric Plugin on Android Studio and then register/upload the app by running it. I have few questions about the same topic.
How to upload a Cordova (Ionic) based project to Crashlytics?
How to use this cordova-crashlytics plugin?
Any help is very helpful.
This can be done without Android Studio and without "uploading your app/project" to Crashlytics and without having their Fabric plugin. I'm working on a Cordova app using the Cordova CLI tool with Cordova Android platform 3.7.2. I got Crashlytics working by usign this slightly updated Cordova plugin: https://github.com/smistry-toushay/cordova-crashlytics-plugin
First get your Crashlytics Secret and Key by visiting the "Organizations Page" in your Crashlytics dashboard. Select your org at: https://www.crashlytics.com/settings/organizations and click on the links for "API Key" and "Build Secret" right underneath the org's name to copy those values.
Then run this on a command line in your Cordova directory:
cordova plugin add https://github.com/smistry-toushay/cordova-crashlytics-plugin.git --variable CRASHLYTICS_API_SECRET=YOUR CRASHLYTICS API SECRET HERE --variable CRASHLYTICS_API_KEY=YOUR CRASHLYTICS API KEY HERE
That should then add your Cordova App to the Crashlytics dashboard and any subsequent crashes will show up there.
Since developing ionic uses text editors only, and not IDE, we don't really use the android studio. However, for this special case, where native should immerse We will need to force build our app from studio.
What you can do is to
add android platform to cordova app.
import app to Android studio (File, Import Project, yourapp/platform/android)
follow the instruction from Crashlytics.
You can now proceed with your API keys and Build Secret.
on cli, follow the code to add the plugin "cordova plugin add cordova-..."
run the app on android studio.
Please let me know if this helps.
I was able to do this before, but I'll try to help you out everytime.
Cheers!