In case you missed it, last week we gave a live presentation on the top Cordova challenges and the best strategies to overcome them.
During that discussion, Ionic’s Senior Product Evangelist, Matt Netkow, and I dug into the top challenges that development teams face when working with Cordova to unlock native features in a hybrid mobile app. This included tackling dependency management, addressing failed builds, and crafting ongoing maintenance strategies. If you’d like to learn more, check out the on-demand recording.
The purpose of this post is to go back and address some of the great questions that we weren’t able to get to in the Q&A session. Some of them are specific to Cordova, and some are about Ionic 4 (or Ionic 3) application development in general.
How can I run and debug my Ionic app from within Android Studio or Xcode?
There are several Ionic command line options you can use to package and run your app locally on an Android or iOS device. If you run them from each dedicated IDE (Android Studio or Xcode) though, you can view native logs in addition to web logs – incredibly useful for debugging Cordova issues.
Within Android Studio:
1. Select the “Profile or Debug APK” option from the Welcome screen.
2. Navigate to the APK file from within your Ionic project:
Within Xcode (only available on a Mac):
1. Go to “File > Open”.
2. Navigate to your Ionic project, and open the
Note that you will need to select a development team (provisioning profile) associated with your app before you can run it. This is due to Apple’s code signing requirements.
Finally, in either IDE, click on the “Play” button to run your app using a simulator/emulator or a physical device.
What are some strategies for addressing native mobile performance issues?
The recommended approach will vary greatly depending on the application and the Cordova plugins in use. That said, here are some general strategies:
- Update to the latest versions of the Cordova plugins (and platforms) used in your application. This can result in increased performance, but it isn’t guaranteed.
- Perform an audit of your Cordova plugins. Removing those that are no longer needed may improve application startup times.
- Consult with the Ionic team. We offer a variety of Cordova-related assistance, including Advisory Services, Architecture Reviews, and more.
What are the best ways to keep up with iOS and Android Cordova updates?
Keeping up with the constantly changing mobile landscape can be difficult. There are always new operating system updates, hardware form factors, and thousands of mobile phones and tablets available at any given time.
Besides the Ionic blog, follow the Cordova team’s blog, a great source of information for the latest Cordova platform releases. These announcements (like the most recent
cordova-android 8.0.0 and
cordova-ios 5.0.0) include release notes on improved functionality, performance, and features that can make your development experience and applications better.
As for keeping track of plugin updates, there are a few handy commands and resources at your disposal:
- The best resource for any given Cordova plugin is its associated GitHub repository. Most plugin repositories include information regarding general plugin details, including known or existing issues, code examples, and release notes.
- To get a snapshot of the current state of your application’s plugins, run some of the commands we mentioned during the presentation, such as:
ionic doctor check: Detect common Ionic project issues and suggestions to fix them.
cordova plugin ls: Once you’ve added at least one Cordova platform to your project (via
ionic cordova platform add <platform>), run this command to determine the exact version of the Cordova plugins installed in your app. This is useful for general troubleshooting, comparing development environments, or checking that your plugins are actually being installed with the versions you specify.
npm outdated <dependency>: Review all project dependencies (or a specific one) to see if any updates are available. Caution: We don’t recommend updating a plugin just because there is an update available, or all of them at once! Make small, iterative changes in a separate code branch and perform lots of testing.
What version of Node.js does Ionic support?
We recommend using the Long Term Support (LTS) version of Node.js as it is the most stable option for Ionic apps. Understandably, not all dev teams are able to update frequently, but it’s generally OK to use an older version of Node with your Ionic project as long as it builds (
ionic build) and runs successfully.
You mentioned that Cordova plugins may conflict with each other when they share the same underlying native dependencies (i.e. Google Play Services). What’s the best way to tackle this issue?
Unfortunately, there isn’t a catch-all solution. The answer to this question in part depends on the plugins you’re using. For example, the popular cordova-plugin-firebase plugin can conflict with other plugins like cordova-plugin-googleplus or google-analytics-plugin because the underlying Play Services versions don’t match.
One possible solution is to add cordova-android-play-services-gradle-release to your Ionic project. It attempts to resolve the issue by forcing a specific Google Play Services version for all plugins in your Ionic/Cordova project. This may require you to do some testing to find out which version of Play Services your app should be using. Check the Github repo for more information, and don’t be afraid to try things out!
Is there any way to build and submit iOS apps without owning a Mac?
In order to build and submit an iOS app to the App Store, Apple’s Xcode software is required. Unfortunately, it only runs on Mac computers.
When it comes to building iOS apps, there are some options:
- You can develop and test your apps using a Mac and a connected iOS device without a paid Apple Developer account.
- Ionic’s Package service allows you to create native app binaries in the cloud, taking away a lot of the pain of managing iOS provisioning profiles and certificates away, especially for larger development teams. Ionic Package creates the IPA binary file that can then be submitted to the App Store – either manually with Xcode’s Application Loader or in an automated fashion using Appflow’s CI/CD capabilities.
When you’re ready to submit your app to the App Store, follow along here.
Ionic’s Native Bridge feature, part of Ionic Enterprise Edition, takes it a step forward, providing easy access to native features and third-party apps for professional development teams building mission-critical apps in an enterprise environment, where time-to-market, support, and stability are critical.
If you would like to learn more about how Ionic Enterprise Edition can help your team tackle its development projects with stability and speed, get in touch with one of our Solution Engineers today.