distriqt / ANE-CustomResources

Android Custom Resources for AIR Applications
https://airnativeextensions.com
15 stars 4 forks source link

Tool versions working with Windows 10? #16

Closed A4TIF closed 7 years ago

A4TIF commented 7 years ago

Can you confirm what versions of:

Ant Java SDK AIR SDK

were used to get this working on 10?

I have

Ant 1.10.1 jdk1.8.0_131 Air 26 Latest Android SDK

Trying to build firebase android config ANE

Please advice

marchbold commented 7 years ago

Can you make sure you have the latest version of the script? That console output looks like its from the old version.

A4TIF commented 7 years ago

I copied from latest firebase code. I think that needs to be updated?

marchbold commented 7 years ago

Yes, the firebase version is going to be removed. Please use the version in this repository Cheers

A4TIF commented 7 years ago

Sorry I posted in another issue thread, moving back to this one. I'm now getting this error:

>ant
Buildfile: C:\Users\Debug\Desktop\config\build.xml

clean:

clean_actionscript:

clean_default:

clean_android:

build:

build_actionscript:
     [echo] Building actionscript library...
    [compc] Loading configuration: C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.6.0\frameworks\air-config.xml
    [compc]
    [compc]
    [compc] 2172 bytes written to C:\Users\Debug\Desktop\config\platform\actionscript\bin\distriqt.extension.config.swc in 0.777 seconds
    [compc]
     [echo] done

build_default:
     [echo] Building default library...
    [compc] Loading configuration: C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.6.0\frameworks\air-config.xml
    [compc]
    [compc]
    [compc] 2016 bytes written to C:\Users\Debug\Desktop\config\platform\default\bin\distriqt.extension.config.default.swc in 0.669 seconds
    [compc]
     [echo] done

create_android_project:
    [mkdir] Created dir: C:\Users\Debug\Desktop\config\platform\android\app
     [copy] Copying 4 files to C:\Users\Debug\Desktop\config\platform\android\app
    [mkdir] Created dir: C:\Users\Debug\Desktop\config\platform\android\app\src\main\java\com\map\in
     [copy] Copying 2 files to C:\Users\Debug\Desktop\config\platform\android\app\src\main\java\com\map\in
    [mkdir] Created dir: C:\Users\Debug\Desktop\config\platform\android\app\src\main\res
     [copy] Copying 1 file to C:\Users\Debug\Desktop\config\platform\android\app\src\main\res
     [copy] Copying 1 file to C:\Users\Debug\Desktop\config\platform\android
     [copy] Copying 1 file to C:\Users\Debug\Desktop\config\platform\android\app\libs

build_android:
     [echo] Building Android library...

build_android_osx:

build_android_windows:

BUILD FAILED
C:\Users\Debug\Desktop\config\build.xml:215: The following error occurred while executing this line:
C:\Users\Debug\Desktop\config\build.xml:146: The following error occurred while executing this line:
C:\Users\Debug\Desktop\config\build.xml:163: Execute failed: java.io.IOException: Cannot run program "gradlew.bat" (in directory "C:\Users\Debug\Desktop\config\platform\android"): CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at java.lang.Runtime.exec(Runtime.java:620)
        at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:426)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:440)
        at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:629)
        at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670)
        at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.Main.runBuild(Main.java:857)
        at org.apache.tools.ant.Main.startAnt(Main.java:236)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:113)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
        at java.lang.ProcessImpl.start(ProcessImpl.java:137)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 49 more

Total time: 2 seconds

Following are the environment variables:

ANT_HOME = C:\apache-ant\apache-ant-1.10.1 JAVA_HOME = C:\Program Files\Java\jdk1.8.0_131 JRE_HOME = C:\Program Files\Java\jre1.8.0_131

Amended Path variable with: %JAVA_HOME%\bin;%JRE_HOME%\bin;%ANT_HOME%\bin

Note: I was able to generate the ANE via mac OSX, but that was a loaner mac, and I need to use Windows for this to work and make further changes in the future. Please advice.

A4TIF commented 7 years ago

I just pulled the latest version and got the same issue in Windows 10.

marchbold commented 7 years ago

Can you confirm you have gradlew.bat file in C:\Users\Debug\Desktop\config\platform\android and that it has executable permissions?

A4TIF commented 7 years ago

Yes its there. Executable permissions are also there.

marchbold commented 7 years ago

How are you executing ant? Are you in the same directory as build.xml?

A4TIF commented 7 years ago

Yes

A4TIF commented 7 years ago
PS D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master> ls

    Directory: D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
da----        31-May-17   1:36 AM                build_config
da----        31-May-17   1:36 AM                images
da----        31-May-17   1:36 AM                platform
da----        31-May-17   2:45 PM                res
-a----        31-May-17   1:36 AM             12 .gitignore
-a----        31-May-17   1:36 AM           9118 build.xml
-a----        31-May-17   1:36 AM             32 CHANGELOG.md
-a----        31-May-17   1:36 AM           4857 README.md

PS D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master> ant
Buildfile: D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\build.xml

clean:

clean_actionscript:
   [delete] Deleting directory D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\actionscript\bin

clean_default:
   [delete] Deleting directory D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\default\bin

clean_android:
   [delete] Deleting directory D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\android\app

build:

build_actionscript:
     [echo] Building actionscript library...
    [compc] Loading configuration: C:\airsdk\frameworks\air-config.xml
    [compc]
    [compc]
    [compc] 2172 bytes written to D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\actionscript\bin\distriqt.extension.firebase.swc in 1.059 seconds
    [compc]
     [echo] done

build_default:
     [echo] Building default library...
    [compc] Loading configuration: C:\airsdk\frameworks\air-config.xml
    [compc]
    [compc]
    [compc] 2016 bytes written to D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\default\bin\distriqt.extension.firebase.default.swc in 0.786 seconds
    [compc]
     [echo] done

create_android_project:
    [mkdir] Created dir: D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\android\app
     [copy] Copying 4 files to D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\android\app
    [mkdir] Created dir: D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\android\app\src\main\java\com\project\test
     [copy] Copying 2 files to D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\android\app\src\main\java\com\project\test
    [mkdir] Created dir: D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\android\app\src\main\res
     [copy] Copying 1 file to D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\android\app\src\main\res
     [copy] Copying 1 file to D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\android
     [copy] Copying 1 file to D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\android\app\libs

build_android:
     [echo] Building Android library...

build_android_osx:

build_android_windows:

BUILD FAILED
D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\build.xml:216: The following error occurred while executing this line:
D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\build.xml:146: The following error occurred while executing this line:
D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\build.xml:163: Execute failed: java.io.IOException: Cannot run program "gradlew.bat" (in directory "D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master\platform\android"): CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at java.lang.Runtime.exec(Runtime.java:620)
        at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:426)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:440)
        at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:629)
        at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670)
        at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.Main.runBuild(Main.java:857)
        at org.apache.tools.ant.Main.startAnt(Main.java:236)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:113)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
        at java.lang.ProcessImpl.start(ProcessImpl.java:137)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 49 more

Total time: 3 seconds
PS D:\downloads\ANE-CustomResources-master\ANE-CustomResources-master>
A4TIF commented 7 years ago

I also got CMD console "Run as Administrator" and then ran ant, and got the same results. :(

marchbold commented 7 years ago

Have you installed android studio and run at least once to install dependencies?

A4TIF commented 7 years ago

Yes, I have installed android sdk 23 to 25 on my PC. What other dependencies are we looking at here?

A4TIF commented 7 years ago

I think your build script is wrong for Windows

I have googled and what I noticed was that "/c" switch is used for gradlew.bat. Not sure how to get this going in ant, as I'm not very good with it, I will definitely play around with it today and see if I can get any good results.

A4TIF commented 7 years ago

Found this: https://ant.apache.org/manual/Tasks/exec.html

Windows Users

The task delegates to Runtime.exec which in turn apparently calls ::CreateProcess. It is the latter Win32 function that defines the exact semantics of the call. In particular, if you do not put a file extension on the executable, only ".EXE" files are looked for, not ".COM", ".CMD" or other file types listed in the environment variable PATHEXT. That is only used by the shell.

Note that .bat files cannot in general by executed directly. One normally needs to execute the command shell executable cmd using the /c switch.

<target name="help">
<exec executable="cmd">
<arg value="/c"/>
<arg value="ant.bat"/>
<arg value="-p"/>
</exec>
</target>

A common problem is not having the executable on the PATH. In case you get an error message Cannot run program "...":CreateProcess error=2. The system cannot find the path specified. have a look at your PATH variable. Just type the command directly on the command line and if Windows finds it, Ant should do it too. (Otherwise ask on the user mailinglist for help.) If Windows can not execute the program add the directory of the program to the PATH (set PATH=%PATH%;dirOfProgram) or specify the absolute path in the executable attribute in your buildfile.

A4TIF commented 7 years ago

So here's what I did to get it to work: Replaced the build_android_windows in build.xml:

    <target name="build_android_windows" if="is_windows">
        <exec executable="gradlew.bat" dir="${android.dir}">
            <arg line="wrapper" />
        </exec>
        <exec executable="gradlew.bat" dir="${android.dir}">
            <arg line="assemble" />
        </exec>
    </target> 

With this:

    <target name="build_android_windows" if="is_windows">
        <exec executable="cmd" dir="${android.dir}">
            <arg value="/c"/>
            <arg value="gradlew.bat"/>
            <arg value="wrapper" />
        </exec>
        <exec executable="cmd" dir="${android.dir}">
            <arg value="/c"/>
            <arg value="gradlew.bat"/>
            <arg value="assemble" />
        </exec>
    </target> 

Removed all of this below:

        <!-- PROPERTIES -->
        <copy file="${android.dir}/template/local.properties" tofile="${android.dir}/local.properties" overwrite="true" >
            <filterchain>
                <tokenfilter>
                    <replacestring from="@ANDROIDSDK@" to="${android.sdk}"/>
                </tokenfilter>
            </filterchain>
        </copy>

Created local.properties file in template folder and added this line:

sdk.dir=C:\\Users\\Debug\\AppData\\Local\\Android\\sdk

And it worked!

marchbold commented 7 years ago

Ah interesting, nice work!

Will investigate those changes out on our windows machines, but they all seem reasonable replacements.