Resource folder not included.. Problem is " Unable to transcode ..."

thomas.auinger's Avatar

thomas.auinger

17 Jan, 2013 11:25 AM

Working on my Maven to Gradle migration I am now encountering problems getting resources into the build. Resources are placed in the default "src/main/resources" directory, which I have declared just to be sure:

srcDirs  = [
    "src/main/flex"
]
resourceDirs = [
    "src/main/resources"
]

Here is the output of my build (using SDK 3.6 and GradleFX 0.6). Note that I am trying with and without leading slash! Also, I have tried with SDK 4.9 and GradleFX 0.6.3 which produces the same transcoding errors.

D:\Workspaces\Flex\codebank-flex>gradle clean build
:clean UP-TO-DATE
:compileFlex
WARNING: The -external-library-path option is being used internally by GradleFx. Alternative: specify the library as an 'external' Gradle dependendency
:: loading settings :: url = jar:file:/D:/Java/gradle-1.3/lib/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
Compiling with compc
        -external-library-path+=C:\Users\aui\.gradle\gradleFx\sdks\1a2671edac53558c3e843c377acc68b216185050/frameworks/libs/player/{targetPlayerMajorVersion}.{targetPlayerMinorVersion}/playerglobal.swc
        -runtime-shared-library-path=
        -external-library-path+=C:\Users\aui\.gradle\gradleFx\sdks\1a2671edac53558c3e843c377acc68b216185050/frameworks/libs/framework.swc
        -source-path+=D:\Workspaces\Flex\codebank-flex\src\main\flex
        -include-sources+=D:\Workspaces\Flex\codebank-flex\src\main\flex
        -include-file
        assets/cursor_move.gif
        D:\Workspaces\Flex\codebank-flex\src\main\resources\assets\cursor_move.gif
        -include-file
        assets/cursor_resize.gif
        D:\Workspaces\Flex\codebank-flex\src\main\resources\assets\cursor_resize.gif
        -include-libraries+=C:\Users\aui\.gradle\caches\artifacts-15\filestore\de.byteconsult\mate-bc\0.89.0\swc\36f1f02ea14bc8da9329659461830be5819ac410\mate-bc-0.89.0.swc
        -include-libraries+=C:\Users\aui\.gradle\caches\artifacts-15\filestore\org.springextensions.actionscript\spring-actionscript-core\1.1\swc\c171143a76efb7a983911edee5b8e23b49055f4d\spring-actionscript-core-1.1.swc
        -include-libraries+=C:\Users\aui\.gradle\caches\artifacts-15\filestore\org.as3commons\as3commons-lang\0.3.6\swc\c5364058044e9475372e6de2c46c0440c9fe5433\as3commons-lang-0.3.6.swc
        -include-libraries+=C:\Users\aui\.gradle\caches\artifacts-15\filestore\org.as3commons\as3commons-logging\1.2\swc\fa5f0bc9e45193b4561b9bcda14e6490307ad2e1\as3commons-logging-1.2.swc
        -include-libraries+=C:\Users\aui\.gradle\caches\artifacts-15\filestore\org.as3commons\as3commons-reflect\1.3.1\swc\1729cd341cfea17962c5eba489c99af7e3d79f9c\as3commons-reflect-1.3.1.swc
        -include-libraries+=C:\Users\aui\.gradle\caches\artifacts-15\filestore\org.as3commons\as3commons-bytecode\0.7\swc\cf08d8dc7cb902c9a4072b147ec5ece6bebef4c2\as3commons-bytecode-0.7.swc
        -target-player=10.0
        -external-library-path=C:\Users\aui\.gradle\gradleFx\sdks\1a2671edac53558c3e843c377acc68b216185050/frameworks/libs/player/{targetPlayerMajorVersion}/playerglobal.swc
        -output=D:\Workspaces\Flex\codebank-flex\build\codebank-flex.swc
[ant:java] Java Result: 4
:compileFlex FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileFlex'.
> compc execution failed: Loading configuration file C:\Users\aui\.gradle\gradleFx\sdks\1a2671edac53558c3e843c377acc68b216185050\frameworks\flex-config.xml
  D:\Workspaces\Flex\codebank-flex\src\main\flex\de\byteconsult\codebank\ui\managers\MoveManager.as(43): col: 4: Error: unable to resolve 'assets/cursor_move.gif' for transcoding

                [Embed(source="assets/cursor_move.gif")]
     ^

  D:\Workspaces\Flex\codebank-flex\src\main\flex\de\byteconsult\codebank\ui\managers\MoveManager.as(43): col: 4: Error: Unable to transcode assets/cursor_move.gif.


     ^

  D:\Workspaces\Flex\codebank-flex\src\main\flex\de\byteconsult\codebank\ui\managers\ResizeManager.as(45): col: 4: Error: unable to resolve '/assets/cursor_resize.gif' for transcoding

                [Embed(source="/assets/cursor_resize.gif")]
     ^

  D:\Workspaces\Flex\codebank-flex\src\main\flex\de\byteconsult\codebank\ui\managers\ResizeManager.as(45): col: 4: Error: Unable to transcode /assets/cursor_resize.gif.


     ^



* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED
  1. Support Staff 1 Posted by Maxime Cowez on 17 Jan, 2013 12:15 PM

    Maxime Cowez's Avatar

    This is not a GradleFx issue; it's directly related to the compiler. FlashBuilder has some tricks to resolve certain paths that mxmlc doesn't have, which is probably why you don't get these errors when you compile through the IDE.

    To fix it, you must adjust the paths in the Embed statements.
    Supposing your directory structure is like this:

    • src/main/flex
    • src/main/assets

    it should be something like:

    [Embed(source="/../assets/cursor_resize.gif")]
    

    (From the 'flex' dir, go up one directory, and go back down into assets)

    On a side note: src/main/flex is not the default, src/main/actionscript is.

  2. 2 Posted by thomas.auinger on 17 Jan, 2013 12:20 PM

    thomas.auinger's Avatar

    BUILD SUCCESSFUL!

    Thanks heaps!!

    Side note: I am declaring like this now:

         [Embed(source="/../resources/assets/cursor_move.gif")]
            public var moveIcon:Class;
    

    However ;) when compiling with Maven/Flexmojos I did not have to rewrite my embed statements.. Somehow flexmojos could cope...?

  3. Support Staff 3 Posted by Maxime Cowez on 17 Jan, 2013 12:23 PM

    Maxime Cowez's Avatar

    Good to know.
    Perhaps we could add this feature one day.

  4. Support Staff 4 Posted by Yennick Trevels on 17 Jan, 2013 06:10 PM

    Yennick Trevels's Avatar

    You can also create an assets folder under src/main/flex.
    So for example your configuration is this:

    srcDirs  = [
        "src/main/flex"
    ]
    

    Then you create the following directory structure with the gif in it:

    src/main/flex/assets/cursor_move.gif
    

    Then you can reference this gif in your code like this:

    @Embed('/assets/cursor_move.gif')
    

    The thing here is that cursor_move.gif will be embedded into the application, so it should be under a source folder. 'src/main/resources' is more for configuration files (like xml) which aren't compiled into the application but are read at runtime.

    See this sample project for an example: https://github.com/GradleFx/GradleFx-Examples/tree/master/multiproj...

  5. 5 Posted by Abhijeet on 22 Jan, 2014 04:08 AM

    Abhijeet's Avatar

    http://www.boostworthy.com/blog/?p=220

    "I believe this occurs when the sources of the Flash Builder project are not directly rooted in the project directory. You can check for that by looking under:

    Project -> Properties -> Flex Library Build Path -> Library Path

    There you’ll find the “Main source folder”. The problem seems to occur whenever the value is not empty."

  6. 6 Posted by foetus58 on 24 Feb, 2015 01:32 AM

    foetus58's Avatar

    I'm having a similar issue, but nothing seems to work for me. Here's is what I've so far:

    these are the directory structure I have tried so far:
    Case 1

    app/
        src/
            com/
                sample
                    sample.as
        assets/
            images/
                sample.jpg
    
    Case 2
    app/
        src/
            com/
                sample
                    sample.as
            assets/
                images/
                    sample.jpg
    
    Case 3
    app/
        src/
            com/
                sample
                    sample.as
        resources
            assets/
                images/
                    sample.jpg
    

    and on my sample.as I have:

    [Embed(source="assets/images/sample.jpg")]
    

    and I'm using these on my build.gradle file:

    For Case 1

    type = 'swc'
    srcDirs  = [
        "src/" 
    ]
    resourceDirs = [
        "assets"
    ]
    dependencies {
        external fileTree(dir: 'libs/', include: '*.swc')
    }
    
    For Case 2
    type = 'swc'
    srcDirs  = [
        "src/" 
    ]
    resourceDirs = [
        "src/assets"
    ]
    dependencies {
        external fileTree(dir: 'libs/', include: '*.swc')
    }
    
    For Case 3
    type = 'swc'
    srcDirs  = [
        "src/" 
    ]
    resourceDirs = [
        "resources"
    ]
    dependencies {
        external fileTree(dir: 'libs/', include: '*.swc')
    }
    

    Any help would be really apreciated

  7. 7 Posted by foetus58 on 24 Feb, 2015 03:40 AM

    foetus58's Avatar

    Sorry, it seems that my problem was not there, the previous solution seems to work, but I also have some images inside the src/ dir is there a way to expose only image files i.e. .jpg, .png, etc?

  8. Support Staff 8 Posted by Yennick Trevels on 27 Feb, 2015 08:32 PM

    Yennick Trevels's Avatar

    Everything you put in src/ will be packaged into your swc/swf, so you will be able to use those in your Embed statements.
    Or can you please clarify what you exactly mean by "expose only images files"? Not sure I understand the question correctly.

  9. 9 Posted by quanhungbang on 18 Dec, 2015 02:52 AM

    quanhungbang's Avatar

    Not change:
    [Embed(source = "/assets/images-mod-authen/spinner.swf")]

    srcDirs = ['src/main/flex/']

    Project structure as image attach.
    Please help me include assets folder to compile. I using command : resourceDirs = ['src/main/resources/'], but not working.

  10. Support Staff 10 Posted by Yennick Trevels on 23 Dec, 2015 06:00 AM

    Yennick Trevels's Avatar

    Can you try to put the assets into the src.main.flex folder?

  11. 11 Posted by thomas.auinger on 23 Dec, 2015 06:07 AM

    thomas.auinger's Avatar

    Sehr geehrter Absender,

    vielen Dank für Ihre Nachricht.

    In der Zeit vom 21.12.2015 bis einschließlich 06.01.2016 lassen wir Konzept- und Beratungsarbeit ruhen und haben Betriebsferien. Am 7. Januar 2016 ist die ByteConsult GmbH wieder für Sie da.

    Ihre Nachricht geht nicht verloren, kann bis dahin jedoch auch nicht gelesen, bearbeitet oder weitergeleitet werden.

    Während der Betriebsferien überprüft unser Support-Team täglich Mails zu den bekannten Support E-Mail Adressen sowie [email blocked] auf eingehende Nachrichten und setzt sich daraufhin mit Ihnen in Verbindung.

    In dringenden Notfällen wenden Sie sich bitte an die Nummer 0171 - 2011 686.

    Thomas Auinger
    Beratung und Leitung Entwicklung

    ByteConsult GmbH | Tel.: +49-(0)931-20510-20 | AG Würzburg, HRB 7262
    Schweinfurter Str. 9 | Mob.: +49-(0)171-2011686 | GF: Jens Helmerich
    97080 Würzburg | http://www.byteconsult.de | Manuel Hermann

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

24 Jun, 2017 02:18 PM
10 Jun, 2017 04:16 PM
24 Mar, 2017 07:10 PM
19 Mar, 2017 04:39 AM
22 Jan, 2017 07:46 AM

 

11 Oct, 2016 01:18 PM
20 Sep, 2016 04:36 PM
06 Sep, 2016 08:05 PM
03 Aug, 2016 11:15 AM
01 Jun, 2016 05:20 PM
03 May, 2016 09:17 PM