There is no exact reason. I just put value already existed in gradle-wrapper.properties.
Actually for android development there is no big profit to always use latest version.
But if you think that we should use 2.13 - itβs ok.
I tried to rewrite ant configs to gradle configs, and found one problem with extensions - every existing extension for OpenFL use ant, but future extensions should also use gradle.
To add dependency on gradle project, settings.gradle should be used, but to add dependency on ant project, different approach should be used, http://stackoverflow.com/a/31471212 for example.
So we need somehow generate one code for gradle extensions, and different code for ant extensions.
What if we insert a build.gradle file into the Ant project? (I think this is possible.) Then we could import everything via settings.gradle.
Thanks for offering to write build.gradle. If you can handle that, Iβll be happy to restructure the project. First, Iβd just like to make sure weβre on the same page.
Based on the above link, hereβs what Iβm planning:
The names βdependency0,β βdependency1,β and βcom/project/pathβ are placeholders. Other than that, those are the exact names Iβm planning to use.
I removed a few files/folders (notably androidTest); let me know if I should add them back. Otherwise, does that look good?
Thatβs good. If build.gradle already exists, than it was new extension, and we should do nothing, otherwise it is old extension, and we can put build.gradle with following contents:
gradle.properties - not sure if it is good for generated project, but probably we can put here version codes, build tools versions and etc. Obliviously, we can put it directly to build.gradle (because this file will be generated), but at my point of view, it will be more cool to keep settings in special file.
local.properties - things like sdk.dir and ndk.dir should go here.
settings.gradle - to include dependencies.
deps/ - we can leave dependencies in separate folder (like current).
app/src/main/jniLibs/ - while app/libs is for .jar, jniLibs is for .so files. Iβm not sure why libs/ is just inside app/, but jniLibs/ is inside app/src/main/ - I just take everything from various real-world projects. It need more investigation.
File structure updated. I havenβt updated build.gradle, so it wonβt compile yet.
Agreed.
Note: build.gradle will be generated by default, but users have the option to override it. To avoid surprises, the generated project should be set up exactly like a normal Android project.
Oddly, the current setup doesnβt use this, and Iβm pretty sure itβs relevant to Ant as well as Gradle. We might want to ask Joshua about it.
Convenient! I left that exactly as-is.
I created a sample project in Android Studio, and it put the libs folder there. And this screenshot shows it in the same place. I didnβt find any explanations as to why, but no one seemed to question it, so Iβll go with it.
(Also, this confirms that jniLibs should be under src/main.)
What about moving sdk versions and version name / code into gradle.properties?
Also we need add signing config:
Additionally we can give ability to configure build tools version.
It seems that extension folder structure donβt respect gradle folder structure.
Probably you should either make a different folder structure, or add sourceSets to build.gradle:
For the signing process, I decided to allow both options. You can use the <certificate /> tag, signing.properties, or neither. I just hope Gradle can handle null values, because my code doesnβt even check.
By the way, I changed this line. Let me know if I should change it back.
I tested some sample projects, in both Next and Legacy. Results:
AddingAnimation: success!
AddingText: success!
BunnyMark: crashes in Next mode, fails to compile in Legacy. However, this happens with or without Gradle.
DisplayingABitmap: success!
HandlingMouseEvents: success!
NyanCat: success!
PiratePig: success!
PlayingSound: success!
My own project, including templates and Ant library projects: success!
Itβs currently only available on my GitHub page. I havenβt yet submitted a pull request because I wasnβt able to test it with the latest changes. The error seems unrelated, so hopefully theyβll fix it.
You might want to check out this version, since the latest isnβt compatible with OpenFL 3.6.1. Also, run tools.hxml and copy the ndll folder from Lime 2.9.1.
Hi, Iβm just getting started with openfl so apologies for an ignorant question. IIUC lime currently builds to Android in two steps: first compiling .cpp to .so by explicity running gcc from the ndk, and second using ant to generate a .apk from the .so and java code. Does your change switch both steps or only the second to use gradle?
I ask because this would presumably make the first step less dependent on the ndk version. Using r12b I had to copy a folder from 4.9.x to 4.9 to get it working.