Cordova Android 7.0.0 released!


#1

Cordova just released version 7.0.0 of cordova-android:

https://cordova.apache.org/announcements/2017/12/04/cordova-android-7.0.0.html

This version switches the Android project from the ancient structure to a modern one where the app code actually lives in app - so Android Studio and Android tooling is a lot more happy with it.

It is not installed by default yet, so you have to switch manually:

ionic cordova platform remove android
ionic cordova platform add android@7.0.0

The path changes can mean that some plugins don’t work any more, so it would be really nice if you could test it with your project and report any problems here or (if they are clearly problems with cordova-android) at issues.cordova.io

Happy testing!


Can't run cordova run android in Ionic project
Latest version of cordova-android Ionic
#2

What does this new feature from the Cordova page mean - is this an issue for Deploy?

“Due to the directory structure change, we no longer support in-line upgrading, bringing us in line with iOS”

  • A.

#3

Nah, there was a cordova upgrade command that could be used to upgrade the platform without removing it first. This didn’t work for iOS for quite some time, and now also doesn’t for Android.

No connection to Ionic Deploy.


#4

https://twitter.com/macdonst just annonced the release of https://github.com/phonegap/phonegap-plugin-push 2.1.2 to support cordova-android 7.0.0


#5

Diff is mostly installation instructions and something in the gradle file, both connected to the changed paths:
https://github.com/phonegap/phonegap-plugin-push/compare/v2.1.1...v2.1.2
(Can ignore the README formatting and contributor list addition)


#6

Seems to work fine. Plugins used:

  <plugin name="ionic-plugin-keyboard" spec="^2.2.1"/>
  <plugin name="cordova-plugin-whitelist" spec="^1.3.1"/>
  <plugin name="cordova-plugin-device" spec="^1.1.4"/>
  <plugin name="cordova-plugin-splashscreen" spec="^4.0.3"/>
  <plugin name="cordova-plugin-ionic-webview" spec="^1.1.16"/>
  <plugin name="cordova-plugin-local-notification" spec="^0.8.4"/>
  <plugin name="cordova-plugin-app-version" spec="^0.1.9"/>
  <plugin name="cordova-plugin-statusbar" spec="^2.3.0"/>
  <plugin name="cordova-plugin-globalization" spec="^1.0.8"/>
  <plugin name="cordova-plugin-file" spec="^5.0.0"/>
  <plugin name="cordova-plugin-file-opener2" spec="^2.0.19"/>
  <plugin name="cordova-plugin-file-transfer" spec="^1.7.0"/>
  <plugin name="cordova-plugin-network-information" spec="^1.3.4"/>

#7

7 posts were split to a new topic: White screen bug


#8

@Sujan12 agree with you. I hope I will find time in the next couple of days to try to update, let’s see if the other plugins I used are or will be compatible too (look like only the path is the big deal)


#9

cordova.plugins.diagnostic causes issues for me when upgrading, looks like the hardcoded path of AndroidManifest.xml is wrong :

Failed to install 'cordova.plugins.diagnostic': Error: ENOENT: no such file or directory, open 'C:\Projects\SecretName\platforms\android\AndroidManifest.xml'

Any idea how to fix this? I’m getting it with latest diagnostic plugin too.


#10

cordova-plugin-firebase is throwing an error on “Preparing Firebase on Android”:

no such file or directory …\platforms\android\res\values\strings.xml

That appears to have moved to app\src\main\res\values now

I edited cordova-plugin-firebase/scripts/after_prepare.js @ stringsXml: ANDROID_DIR + ‘/app/src/main/res/values/strings.xml’ before adding cordova, and have verified that strings.xml was updated with the correct settings after adding Cordova 7.0


#11

@fpajor maybe opening an issue or submitted a PR in the cordova.plugins.diagnostic GitHub tracker? (https://github.com/dpa99c/cordova-diagnostic-plugin)


#13

Create an issue at the plugin’s Github repo, include the information that this is about cordova-android 7.0.0 and a link to the announcement blog post - it includes the necessary information.


#14

Please also create an issue with the plugin at Github. Include the information that this is about cordova-android 7.0.0 and a link to the announcement blog post - it includes the necessary information. Of course also include your manual workaround.

(Problem with just your workaround is that it then doesn’t work with pre Cordova-Android 7.0.0 any more…)


#18

cordova-plugin-facebook4 isn’t compatible with cordova-android@7.0.0 I think. I have opened an issue:


#19

A propos, does someone know the reason behind this breaking change (“new default project structure for Android projects”) in cordova-android@7.0.0 which potentially impact of lot of plugins?


#20

cordova-android still produced an Android project of the structure that was modern when Android used Eclipse. They moved stuff around a long time ago, and it got harder and harder to make Android Studio (and other Android tooling) to play well with that structure. This update moves some stuff around, which also enabled dropping quite some code for supporting that old structure.

(And I agree breaking the plugins is a bad thing… could maybe have been handled differently. But there are only a limited number of volunteer commiters to Cordova, so…)


#21

@Sujan12 thx a lot for the explanation, it makes then perfectly sense!

I guess we all gonna try to follow this upgrade one plugin after the other and at some point in the future, as always, everything gonna be good and sunny again, till the next breaking change :wink:


#22

At least the version actually did increase the MAJOR part, so it can’t come as a surprise :wink:


#23

2 posts were split to a new topic: Cordova-android 7.0.0: Failed to install ‘ionic-plugin-keyboard’: Error: ENOENT:


#26

how can I go back to Cordova 6?

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 8.0.0 

local packages:

@ionic/app-scripts : 3.1.6
Cordova Platforms  : android 7.0.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v9.2.1
npm               : 5.6.0 
OS                : Linux 4.4

Environment Variables:

ANDROID_HOME : /home/ajm/Android/Sdk

Misc:

backend : pro