What is required Ionic development enironment?

Sorry if this sounds more like a rant… but…

I have an Ionic app which has been running for numerous years (with ongoing development) and has been built numerous with little issue. Recently we were required to update one of the plugins we use and we can now no longer can build with Android (more on that in a bit). The plugin developer says we need to update to:

  • compileSdkVersion = 27
  • buildToolsVersion - 27.0.3
  • latest version of Gradle

With hours of searching through google results i still have some major questions:

  • what versions do i have?
  • how do i upgrade?
  • what do i need / what versions of what tools are required for a working Ionic development system?

Why does Ionic not have a simple command to list your environment and flag which things need to be updated or are not compatible with other parts?

Yes, ionic info spits out a small part of this:

E:\www\UStayMaster>ionic info
Your system information:
Cordova CLI: 7.1.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 7
Node Version: v8.9.4
Xcode version: Not installed

but is clearly missing many things like Gradle, Android, etc.

More on the actual error:

I was able to build fine for years. After updating a plugin i get this error:

E:\www\UStayMaster\platforms\android\build\intermediates\exploded-aar\com.pulsatehq.sdk\PulsateSdk\2.12.0\res\layout\card.xml:266:57-71: AAPT: No resource found that matches the given name (at ‘layout_alignBottom’ with value ‘@id/item_image’).

This is related to the plugin which was updated; so that makes sense. I have seen many posts stating to replace @id with @+id but these are for Cordova and not for Ionic. I can edit these but of course they are rewritten as soon as i build.

I used Android SDK manager to install SDK 27 but not sure it is being used. When i add android it states: Android target: android-26 even though in config.xml i have:

<preference name="android-minSdkVersion" value="16" />
<preference name="android-targetSdkVersion" value="27" />
<preference name="android-compileSdkVersion" value="27" />

As a side issue, i also now regularly get this when trying to add android platform:

Error: Failed to fetch platform cordova-android@~6.3.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Failed to get absolute path to installed module

which i am sure is not as a result of the plugin update but more likely because i have updated some parts of my dev system and it has now become flaky. Usually when i get this error i simple redo the platform add and it works the 2nd time.

SUMMARY:

Basic question for now is how do i know what my environment should be for a working Ionic 1 development system. How do i know if this is what i have? And how do i upgrade the parts i need?

This post helped a lot: https://stackoverflow.com/questions/11350692/android-is-not-recognized-as-an-internal-or-external-command

Paths/env vars were missing and this may have helped to at least get Gradle info:
E:\www\UStayMaster>gradle -v


Gradle 4.4

Build time: 2017-12-06 09:05:06 UTC
Revision: cf7821a6f79f8e2a598df21780e3ff7ce8db2b82

Groovy: 2.4.12
Ant: Apache Ant™ version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_73 (Oracle Corporation 25.73-b02)
OS: Windows 7 6.1 amd64

but issue still persists:

:processDebugResources
E:\www\UStayMaster\platforms\android\build\intermediates\exploded-aar\com.pulsatehq.sdk\PulsateSdk\2.12.0\res\layout\card.xml:266:57-71: AAPT: No resource found that matches the given name (at ‘layout_alignBottom’ with value ‘@id/item_image’).

FAILED

This is old and unsupported, update to the most recent version. It will work with old projects as well. (ionic info output will be better as well)

That said: Building native apps is handled by Cordova. Cordova has a nice command cordova requirements that helps understand what is missing and wrong with your environment.

I did:
npm update -g ionic

it went all the way from ionic cli 2.2.1 to 2.2.3 and ionic app lib version increased from 2.2.0 to 2.2.1

ionic info output is exact same amount of info.

still not sure what the correct version is. running ionic serve used to say an update was required and would say what version was avaialable; but doesnt do this anymore. I found this: https://blog.ionicframework.com/announcing-ionic-cli-v3/ but will try this:

npm uninstall -g ionic
npm install -g ionic@latest

hmm, that seems to not be correct. Numerous changes in scripts required as all the ionic commands have changed (not a big deal); but even ionic resources no longer works (and maybe more; but that’s as far as i can go now as adding platform fails). I guess i will go back to cli 2.x

Good luck with an old and unsupported version of the CLI then.

(ionic resources was renamed to ionic cordova resources)

Are you suggesting ionic cli is possibly my issue? I was able to build just fine with ionic 2.2.0 prior to adding the latest version of one plugin. Is there any documentation that describes how to upgrade from 2.2.x to whatever is the latest (as it does not work with older projects as you suggest).

Yes and no. Obviously you have a problem, otherwise you wouldn’t be posting here. There were dozens of releases since the version you are using, so installing the most recent version will certainly be better than what you are using now - especially as I am 100% sure that the current CLI works just fine with old projects.

npm uninstall ionic
npm install -g ionic
ionic -v

should do the job and install 3.20.0 (most recent I think).

ok, thanks for your feedback, but as i posted above, 3.20 does not work with old projects without at least some rework. I don’t mind doing the rework if 1. i thought old cli was the issue (it might be, but unlikely) and 2. if i could find documentation somewhere that listed the required changes.

With 3.x your ionic info output should look very different. If it doesn’t something is wrong somehow.

Hi Sujan,

I think maybe you are missing my point. Yes i was able to install cli 3.20 and yes, ionic info gives a very different result. This is not my concern. My concern is that my old project (with .js scripts for things like before_platform_add, such as ionic resources no longer works).

Ah, i see the confusion, I posted about updating to 2.2.1. Sorry. After that i did get cli updated to 3.20 but numerous things failed after doing this. For example, yes, i switched ionic resources to ionic cordova resources; but i then get errors about incorrect files and it does not run. This was what i meant about a CHANGELOG to describe all the things which need to be done differently when switching to cli 3.x

Changelogs can be found exactly where you would expect them:
https://github.com/ionic-team/ionic-cli/blob/master/CHANGELOG.md which links to https://github.com/ionic-team/ionic-cli/blob/master/packages/ionic/CHANGELOG.md which has this paragraph with links to the older changelogs https://github.com/ionic-team/ionic-cli/blob/master/packages/ionic/CHANGELOG.md#older-changes.

But posting the actual problems here will probably be faster and more efficient.

(Posting the new ionic info output will also enable us to anticipate other problems you will encounter)