Ionic-cli: Cannot generate resources without platform installed

Created on 4 Jun 2017  Â·  7Comments  Â·  Source: ionic-team/ionic-cli

Short description of the problem:

I cannot generate icons and splash screens for platforms that aren't installed.

What behavior are you expecting?

I should be able to generate icons for a platform without having the platform installed. I don't want to install any platforms on my CI system that uses ionic package to build anyway. I also shouldn't need the platform installed, since the resources are generated on a remote server.

Steps to reproduce:

Without any platforms installed:

$ ionic cordova resources ios
✔ Collecting resource configuration and source images - done!
? Platform ios is not installed! Would you like to install it? No
[ERROR] Platform ios not installed.

Post the output of ionic info below please

global packages:

    @ionic/cli-utils : 1.3.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.3.0

local packages:

    @ionic/cli-plugin-cordova : 1.3.0
    @ionic/cli-plugin-ionic1  : 1.3.0
    Cordova Platforms         : android 6.2.3
    Ionic Framework           : unknown

System:

    Node       : v7.10.0
    OS         : Linux 4.10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
enhancement

Most helpful comment

I think the most frustrating thing is

> ionic cordova resources android
✔ Collecting resource configuration and source images - done!
? Platform android is not installed! Would you like to install it? Yes
> cordova platform add --save android
✖ Running command - failed!
[ERROR] An error occurred while running cordova platform add --save android (exit code 1):

        Using cordova-fetch for cordova-android@^6.2.3
        Adding android project...
        Creating Cordova project for the Android platform:
        Path: platforms/android
        Package: com.microvert.mobile
        Name: Micro_Vertical_App
        Activity: MainActivity
        Android target: android-25
        Subproject Path: CordovaLib
        Android project created with [email protected]
        Error: Source path does not exist: resources/android/icon/drawable-hdpi-icon.png

You got nothing after this call. Didn't add platform and generate any resources.

All 7 comments

I think Ionic Package generates resources for you, too.

But, I agree. There isn't really a reason not to.

@dwieeb: Nope, it doesn't. I've had a bunch of issues with missing resources failing my builds.

Build 191 of app 46a4a954:

Adding ios project...
Creating Cordova project for the iOS platform:
    Path: platforms/ios
    Package: se.iFiske.fiskekort
    Name: iFiske Fiskekort
iOS project created with [email protected]
Error: Source path does not exist: resources/ios/icon/icon-40.png

Build 190 of app 46a4a954:

Adding android project...
Creating Cordova project for the Android platform:
    Path: platforms/android
    Package: se.iFiske.fiskekort
    Name: iFiske_Fiskekort
    Activity: MainActivity
    Android target: android-25
Subproject Path: CordovaLib
Android project created with [email protected]
Error: Source path does not exist: resources/android/icon/drawable-hdpi-icon.png

Fixed the builds by running ionic resources before ionic package

I wonder if that's because Package is using CLI v2...

I think the most frustrating thing is

> ionic cordova resources android
✔ Collecting resource configuration and source images - done!
? Platform android is not installed! Would you like to install it? Yes
> cordova platform add --save android
✖ Running command - failed!
[ERROR] An error occurred while running cordova platform add --save android (exit code 1):

        Using cordova-fetch for cordova-android@^6.2.3
        Adding android project...
        Creating Cordova project for the Android platform:
        Path: platforms/android
        Package: com.microvert.mobile
        Name: Micro_Vertical_App
        Activity: MainActivity
        Android target: android-25
        Subproject Path: CordovaLib
        Android project created with [email protected]
        Error: Source path does not exist: resources/android/icon/drawable-hdpi-icon.png

You got nothing after this call. Didn't add platform and generate any resources.

Good thing i have a backup of my platform images folder:
resources/<platform>/

i can execute the command
ionic cordova build <platform>

I suggest in the mean time, generate the resources using an old version of the CLI and cordova-android/cordova-ios. Copy those generated platform images to the folder resources/<platform>/ of your project. Then you can build your project. :)

My experience is to downgrade to ionic 3.12.0 and it should generate the resources.

The original issue will be included in the next CLI release (4.3.0, I believe). If there are additional issues, please create a new issue.

Was this page helpful?
0 / 5 - 0 ratings