AIR dependency problem

wood's Avatar

wood

16 May, 2013 08:03 AM

I followed the example to do this

...

add(new org.apache.ivy.plugins.resolver.URLResolver()) {
name = 'Adobe Air SDK'
addArtifactPattern 'http://download.macromedia.com/air/win/download/[revision]/[module].[ext]'
}

...

dependencies {
merged project(':common')
merged project(':game')
airSDK group: 'com.adobe', name: 'AdobeAIRSDK', version: '3.7', ext: 'zip'
}
...

it returns

* What went wrong:
null

I dont know how to fix the error

--stacktrace

* Exception is:
org.gradle.listener.ListenerNotificationException: Failed to notify project eval
uation listener.
        at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java
:90)
        at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java
:30)
        at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocat
ionHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy8.afterEvaluate(Unknown Source)
        at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(Lifecycle
ProjectEvaluator.java:48)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProj
ect.java:464)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProj
ect.java:77)
        at org.gradle.configuration.DefaultBuildConfigurer$ConfigureProject.exec
ute(DefaultBuildConfigurer.java:38)
        at org.gradle.configuration.DefaultBuildConfigurer$ConfigureProject.exec
ute(DefaultBuildConfigurer.java:36)
        at org.gradle.api.internal.project.AbstractProject.configure(AbstractPro
ject.java:440)
        at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractP
roject.java:435)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuil
dConfigurer.java:32)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(Default
GradleLauncher.java:142)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradle
Launcher.java:113)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLaun
cher.java:81)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.jav
a:38)
        at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execut
e(InProcessGradleLauncherActionExecuter.java:39)
        at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execut
e(InProcessGradleLauncherActionExecuter.java:25)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
        at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions
.java:171)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.
execute(CommandLineActionFactory.java:201)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.
execute(CommandLineActionFactory.java:174)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(
CommandLineActionFactory.java:170)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(
CommandLineActionFactory.java:139)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep
ortingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep
ortingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:48)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.Main.main(Main.java:39)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBoots
trap.java:50)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.j
ava:32)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: java.lang.NullPointerException
        at org.gradlefx.configuration.sdk.SdkInstallLocationFactory.createSdkLoc
ation(SdkInstallLocationFactory.groovy:64)
        at org.gradlefx.configuration.sdk.SdkInstallLocationFactory$createSdkLoc
ation.call(Unknown Source)
        at org.gradlefx.configuration.sdk.states.AbstractCreateSdkInstallLocatio
nState.process(AbstractCreateSdkInstallLocationState.groovy:39)
        at org.gradlefx.configuration.sdk.states.air.CreateAirSdkInstallLocation
State.super$2$process(CreateAirSdkInstallLocationState.groovy)
        at org.gradlefx.configuration.sdk.states.air.CreateAirSdkInstallLocation
State.process(CreateAirSdkInstallLocationState.groovy:40)
        at org.gradlefx.configuration.sdk.SdkInitState$process.call(Unknown Sour
ce)
        at org.gradlefx.configuration.sdk.SdkInitState$process.call(Unknown Sour
ce)
        at org.gradlefx.configuration.sdk.DefaultSdkInitialisationContext.initSd
k(DefaultSdkInitialisationContext.groovy:33)
        at org.gradlefx.configuration.sdk.SdkInitialisationContext$initSdk.call(
Unknown Source)
        at org.gradlefx.plugins.GradleFxPlugin.initializeSDKs(GradleFxPlugin.gro
ovy:70)
        at org.gradlefx.plugins.GradleFxPlugin.configure(GradleFxPlugin.groovy:5
2)
        at org.gradlefx.plugins.AbstractGradleFxPlugin$_apply_closure1.doCall(Ab
stractGradleFxPlugin.groovy:49)
        at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(Cl
osureBackedMethodInvocationDispatch.java:40)
        at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(Cl
osureBackedMethodInvocationDispatch.java:25)
        at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java
:81)
        ... 31 more

BUILD FAILED

  1. Support Staff 1 Posted by Yennick Trevels on 16 May, 2013 08:21 AM

    Yennick Trevels's Avatar

    You also have to specify the flexSDK dependency. You can do this the same way as you defined the AIR SDK dependency or you can use a local flex installation by referencing it with the flexHome convention property.

  2. 2 Posted by wood on 16 May, 2013 09:24 AM

    wood's Avatar

    I tried to use local air. it still returns null

    Here is the change

    airSDK files('C:/AdobeAIRSDK.zip')

  3. Support Staff 3 Posted by Yennick Trevels on 16 May, 2013 10:41 AM

    Yennick Trevels's Avatar

    I think you misunderstood my answer :)
    Only specifying the AIR SDK isn't enough, you also have to specify the Flex SDK, like this:

    repositories {
        add(new org.apache.ivy.plugins.resolver.URLResolver()) {
            name = 'Apache'
            addArtifactPattern 'http://apache.cu.be/flex/4.9.0/binaries/[module]-[revision]-bin.[ext]'
        }
    
        ...air sdk repository
    }
    
    dependencies {
        flexSDK group: 'org.apache', name: 'apache-flex-sdk', version: '4.9.0', ext: 'tar.gz'
        airSDK group: 'com.adobe', name: 'AdobeAIRSDK', version: '3.7', ext: 'zip' 
    }
    

    Look here for a full example: https://github.com/GradleFx/GradleFx-Examples/blob/master/sdk-autoi...

  4. 4 Posted by wood on 16 May, 2013 05:14 PM

    wood's Avatar

    Thanks for your reply. I got this error

    Error: Access of possibly undefined property HIGH_16X16_LINEAR through a reference with static type Class.

    this.stage.quality = StageQuality.HIGH_16X16_LINEAR;
                                                                ^

    as my project is only depend on air (no flex). This is the reason that I just include the airSDK(I can build in Flash Builder)

  5. Support Staff 5 Posted by Yennick Trevels on 16 May, 2013 07:22 PM

    Yennick Trevels's Avatar

    So I guess you have an actionscript only project? Thing is that the Flex SDK contains the compiler, without it GradleFx has nothing to compile your application with.

    In case you have an actionscript only project, you can set the frameworkLinkage property to 'none' so that the compiler doesn't link the Flex framework libraries (since you don't need them):

     frameworkLinkage = 'none'
    

    To fix your error, can you try add the following:

    additionalCompilerOptions = [
        "-swf-version=16"
    ]
    

    I think the constant that you're trying to use is new since FlashPlayer 11.3, and to use it you have to specify that compiler argument. For more info see http://helpx.adobe.com/flash-player/release-note/developer-release-...

  6. 6 Posted by wood on 17 May, 2013 03:30 AM

    wood's Avatar

    Mine is actionscript only project. I followed your instruction and it shows the same error. Thanks for your help

  7. Support Staff 7 Posted by Yennick Trevels on 17 May, 2013 07:54 AM

    Yennick Trevels's Avatar

    Can you try these two combinations and let me know the result:

    1. use GradleFx 0.6.4 and remove the frameworkLinkage property (use the default)
    2. use GradleFx 0.6.3 with the frameworkLinkage property set to 'none'
  8. 8 Posted by wood on 17 May, 2013 03:08 PM

    wood's Avatar

    1 and 2 show the same error

    Background information:
    I have 3 projects
    common (swc). it is using flex lib
    game (swc) depends on common. it is using flex lib
    web (swf) depends on game. it is using air lib

    I can build game and common successfully. web can't

  9. Support Staff 9 Posted by Yennick Trevels on 17 May, 2013 05:05 PM

    Yennick Trevels's Avatar

    I tried building a test case, but couldn't reproduce the problem. Can you try to build a small testcase which reproduces the problem?

  10. 10 Posted by wood on 18 May, 2013 03:59 AM

    wood's Avatar

    Hey Trevels,

    I uploaded my simple project with build.gradle. I tested that and it is failed with the same error. Would you mind checking this for me? Thank you very much!!

  11. Support Staff 11 Posted by Maxime Cowez on 18 May, 2013 11:42 AM

    Maxime Cowez's Avatar

    Hi guys,
    I think I see where the problem originates: I just ran that script and while installing the Flex SDK + AIR I saw the following line:

    player global url: http://fpdownload.macromedia.com/get/flashplayer/updaters/11/playerglobal11_1.swc
    

    Now in the docs it says StageQuality.HIGH_16X16_LINEAR requires at least Flash Player 11.3

    I don't know how the installation process works, more precisely where that playerglobal.swc version is defined (in GradleFx or elsewhere), but at least you know where to start looking. Perhaps you need AIR 3.8beta for that player version? Perhaps the only solution is for Wood to manually configure his Flex SDK with the right playerglobal.swc?

    Cheers,
    Max

    @Wood: btw Trevels is Yennick's last name ;)

  12. Support Staff 12 Posted by Yennick Trevels on 18 May, 2013 09:31 PM

    Yennick Trevels's Avatar

    AIR 3.5 should be sufficient.
    The flashplayer url is coming from this file: http://flex.apache.org/sdk-installer-config.xml
    It's the same file used by the Apache Flex Installer.
    Installing FlashPlayer 11.3 in the sdk could indeed be an option, and then use this configuration:

    additionalCompilerOptions = [
        "-target-player=11.3",
        "-swf-version=16"
    ]
    

    Haven't tested this myself since I didn't have time yet. But certainly worth a try.

  13. Support Staff 13 Posted by Maxime Cowez on 19 May, 2013 01:12 PM

    Maxime Cowez's Avatar

    I guess it would be possible to add a dependency scope (e.g. player) that can override the default that comes with the Flex SDK. Or would that be too complicated?

  14. Support Staff 14 Posted by Yennick Trevels on 19 May, 2013 04:19 PM

    Yennick Trevels's Avatar

    Shouldn't be hard to do.

  15. 15 Posted by wood on 20 May, 2013 07:38 AM

    wood's Avatar

    After modifying the player version in flex-config.xml, I can build the project successfully but the swf size is quite small. the swf size from Flash Builder and gradle are about 8XXKB and 3XXKB respectively. Gradle build is not runnable.
    Thanks

  16. Support Staff 16 Posted by Yennick Trevels on 20 May, 2013 10:49 AM

    Yennick Trevels's Avatar

    I think you can also change the player version by providing it as an argument to the additionalCompilerOptions property (as shown in one of my previous posts), that way you won't have to edit the sdk.

    Regarding the size of your swf, I don't know if you specified the frameworkLinkage property as I said in the beginning of this thread, but it can have something to do with it. When I said that I didn't know that your game (swc) project depended on flexlib, which probably needs the Flex SDK linked in.
    What you can do is remove the frameworkLinkage property and see if it works.

  17. Support Staff 17 Posted by Maxime Cowez on 20 May, 2013 12:53 PM

    Maxime Cowez's Avatar

    If it has dependencies on the Flex framework and frameworkLinkage is set to none it shouldn't compile.

    One other thing: I suspect you're trying to build a mobile app (because of the usage of StageQuality.HIGH_16X16_LINEAR), but the type in the test script you provided is set to swf, which is the type for building a regular web app.
    When you say "Gradle build is not runnable", do you mean it's not runnable in the standalone player, the browser, the AIR player or a mobile device?

  18. Support Staff 18 Posted by Maxime Cowez on 20 May, 2013 01:09 PM

    Maxime Cowez's Avatar

    Wood, I just compiled your test project simply by adding the line suggested by Yennick, except I changed the player version to 11.7 since that seems to come with Flex 4.9.1 by default.

    additionalCompilerOptions = [
        "-target-player=11.7",
        "-swf-version=16"
    ]
    

    It compiled just fine, but when I ran it, it failed at runtime. The reason was that the variable StageQuality.HIGH_16X16_LINEAR was undefined. So I checked the version of my standalone player, which was 11.1 which explains the error: StageQuality.HIGH_16X16_LINEAR doesn't exist in that version of the player.
    So I repeat my question: which player are you running your swf with? And more specifically which version?

    I then downloaded the FlashPlayer debugger 11.7 from http://www.adobe.com/support/flashplayer/downloads.html and used that: the compiled application runs as expected with this player.

  19. 19 Posted by wood on 27 May, 2013 04:03 PM

    wood's Avatar

    I can build it and it is runnable.

    But I still dont understand, there is a huge difference in the swf size between flash builder and gradle even though the compiler options are same.

    Anyway, Thanks Maxime and Yennick!!!

  20. Support Staff 20 Posted by Yennick Trevels on 27 May, 2013 04:29 PM

    Yennick Trevels's Avatar

    The reason that the swf generated by FlashBuilder is bigger can be that FlashBuilder compiled it as a debuggable swf, while with GradleFx it's a non-debuggable swf (so without all the debug information). Just a guess though if this is the case for you.

  21. wood closed this discussion on 08 Oct, 2013 02:00 PM.

Comments are currently closed for this discussion. You can start a new one.

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