I added capacitor via the quasar framework. I didn't add any plugin at first and everything worked perfectly. Then I updgraded to capacitor v3. I followed the guide and my app worked also without any problems. Then I added the geolocation plugin to capacitor. It works as expected in the browser, but when I try it on my native android device it gives me this error:
"Geolocation" plugin is not implemented on android
It looks like I didn't install the plugin, but as I said, it works in the browser.
Ok fixed it, by checking both package.json files (also the one in /src-capacitor). I used capacitor 3 in my web project but capacitor 2 in my capacitor project. I wanted to use v3 so I tried to access the plugin in the way of capacitor v3 which did not work.
This is because Capacitor changes the underlying Gradle files but Android Studio doesn't know.
To fix this, go to Android studio click File -> Sync Project with Gradle Files
Related
I have a situation where my inAppBrowser is not working on android but it's working in IOS, browser and PhoneGap App.
I don't exactly know what's wrong here, but I have the feeling that the following
errors are causing this problem
/System.err: java.lang.ClassNotFoundException: org.apache.cordova.inappbrowser.InAppBrowser
/com.test.wrapper I/System.out: Error adding plugin org.apache.cordova.inappbrowser.InAppBrowser.
Is there anyone who is facing a similar issue? Anybody able to help here?
If this issue is happening recently, the reason is a bug in Cordova Android 7.1.3.
Refer the following links,
Android Class Not Found
Plugin doesn't install correctly
Your best option is to stick with Cordova android 7.1.2 or upgrade to 7.1.4.
You can specify the Cordova Android version while installing like this,
cordova platform add android#7.1.4
The error message tells you the problem. The plugin did not get added to the project.
Uninstall & reinstall the plugin.
cordova plugin remove cordova-plugin-inappbrowser
cordova plugin add cordova-plugin-inappbrowser
I am trying to add cordova plugin at https://github.com/dbaq/cordova-plugin-contacts-phone-numbers in Intel XDK thrid-party plugins. I have given plugin id at com.dbaq.cordova.contactsPhoneNumbers and Repo URl as https://github.com/dbaq/cordova-plugin-contacts-phone-numbers.git but even after bulding the whole project for android, when I use navigator.contactsPhoneNumbers.list after deviceReady event, I get "Cannot read property 'list' of undefined". Is there anything, I am missing. Same thing happens with other cordova plugins located on Github like Cordova CallNumberPlugin located at github.com/Rohfosho/CordovaCallNumberPlugin.
Note that, I have tested the build on android phone but still no success.
I'm running cordova 5. I used to have the android platform 3.7.1 and everything was fine.
Today I upgraded the android platform to 4.0.2 (cordova platform android update#4.0.2). Since then, my compiled projects get a 404 error when trying to load remote .js scripts. Went back to 3.7.1 and it works.
What's the proper way to upgrade a Cordova Android project? Is there a new setting for network access?? Something I missed in the upgrade?
Posting the answer..
So far, the only way for me to make my project work again was to create a new cordova project and re-import plugins and edit config.xml. I tried upgrading the current project in its current folder but it would never work even if the upgrading was a success (according to cordova). Bottom line: upgrading does not work.
If you're running cordova 5.0 the chances are you haven't installed the white-list plugin.
cordova plugin add cordova-plugin-whitelist
or if you want to save the reference to your config.xml file:
cordova plugin add cordova-plugin-whitelist --save
You can find more info here.
This is because cordova uses cordova-android#4.0.0 as the default version now.
http://cordova.apache.org/announcements/2015/04/15/cordova-android-4.0.0.html
You need to add the whitelist plugin as described by #LeftyX earlier.
cordova plugin add https://github.com/apache/cordova-plugin-whitelist.git
But then you also need to edit the config.xml to allow access to your sites - the whitelist plugin only allows access to file URLs by default.
The easiest way to restore functionality is to add:
<!-- A wildcard can be used to whitelist the entire network,
over HTTP and HTTPS.
*NOT RECOMMENDED* -->
<allow-navigation href="*" />
But as you can see, that is not recommended.
You should really lock it down to make it more secure.
Other options are documented in the README for the whitelist plugin.
https://github.com/apache/cordova-plugin-whitelist
Source: After I performed both the steps mentioned above, my 404s disappeared.
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!
I started using phonegap but as a beginner i ran into many problems.
one of the latest is problem with adding plugins
I added plugin of dialogs
org.apache.cordova.dialogs
with command line tool and it added successfully . but after running application in android emulator it never fire deviceReady Event. before adding plugin it was OK.
as a note I should say I installed older versions of plugin but they didn't work either !
Well I found the answer , I was building my project with phonegap but installed cordova plugins , I create a new project with command
cordova create project [folder name] [namespace "like com.example.appname"]
[project name]
and it worked correctly after that and I installed plugins as usual .