Minor update: just figured out how to do away with the global installation of “ninja-build” prerequisite. Now the build system will use the embedded CMake and the embedded Ninja (as provided by Android SDK/NDK) to build Android modules as well as host tools. This should make build with Lua/LuaJIT enabled easier.
I find out something interesting regarding Ninja on Windows host system. It seems to me that it automatically does the right thing already, i.e. using the response file if and only if it is needed. This is so even without setting the above CMake variables. At least this is what I observed in my Win7 VM, which BTW explains why I have no issue at all with the new build system. The response file is used when linking SLikeNet, WebP, Bullet, and Urho3D (if it is STATIC lib type) and not used for all the other 3rd-party STATIC libs. Having said that, I am not sure why the other Windows user(s) had issue though. Anyway, I am done wasting my time with my Win7 for now.
Android build failed
Hey @weitjong hows android build system work going? Is it stable enough to start using it?
P.S. I noticed
Android was renamed to
android and some other dirs with first letter being lower-case introduced. Most of project dirs follow convention of first letter being upper-case. Things are a bit inconsistent.
No. I haven’t found time to continue the plugin development. And also partly because I got distracted by dockerizing the build environment.
Good that you notice it. I intend to gradually turn all dir names to lower case. It will take time though. So the new dir names are using that convention already. Don’t think it’s important to say it out loud.
Will you share your Dockerfile and scripts?
This is off-topic now, but the answer is yes.
I’m trying to compile my application alongside the samples. My app is basically a modified Sample and also resides in the Sample-Folder. (Compiling on desktop(linux) works as intended). Any hint how to tell urho3d-gradle to compile this as well would be very appreciated.
Looking in [urho3d]/android/launcher-app/build.gradle.kts where cmake is configured, it looks like “URHO3D_SAMPLES” are activated as expected but my app is ignored and no shared-lib is created.
I made a gradlew clean and build with ./gradlew -PANDROID_ABI=armeabi-v7a build
EDIT: oh man,…seems like ‘gradlew clean’ was not enough. I removed the whole ‘android/launcher-app/build’-folder which seems to make the job. I guess ‘gradlew clean’ did not clear cmake’s build-releated files…
Initially the “clean” task was customized to delete the CMake build tree as well, but that customization is later changed to just make sure CMake re-run will take place (instead of a full regeneration) for speed/performance reason. In any case, your approach is not the intended use case of the new Android build system. Stay tune for a proper support in the near future.
I have a similar setup and have no problem building for android debug mode so far.
Maybe you can try the build sequence below while waiting. This approach assume you a android device connected your machine:
- cd to the Urho3D directory.
- ./gradlew build
- ./gradlew assembleDebug
- ./gradew installDebug.
I have tested this with current master version with my Nexus 7 and Samsung Notes4 devices. It works quite consistent so far and faster than using Android Studio.
Yes, it worked as soon as I deleted the whole build-folder as the gradle cmake did not detect that there is a new sample folder that needed to be taken into account (see my EDIT-section). Thx for your hint. Those install commands will become handy…
Hi, I’m on Win7, I’m new to android development, maybe a silly question…
when I run
gradlew build -PANDROID_ABI=armeabi-v7a -PURHO3D_LIB_TYPE=SHARED
it successfully produce a launcher-app-armeabi-v7a-debug.apk in android\launcher-app\build\outputs\apk\debug\
but it’s only 7623k, I guess the assets are not in the apk. i do copy the CoreData folder to android\urho3d-lib, and copy Autoload and Data folder to android\launcher-app, but it seems not taking effect.
am i miss something?
This is the first report I received (not counting myself) that the new Gradle build system works for Windows 7 without hitting cmd.exe buffer length issue. Good job.
For the asset dir preparation, make sure you copy them while preserving the sub-directory structure. That is, inside the “assets” dir, there is a sub-dir called “CoreData” and so on. Below just the illustration from my Linux system. Good luck.
[weitjong@igloo android]$ pwd /home/weitjong/ClionProjects/urho3d/Urho3D/android [weitjong@igloo android]$ ls -ltr urho3d-lib/src/main/assets/ total 0 lrwxrwxrwx. 1 weitjong weitjong 27 Aug 22 18:00 CoreData -> ../../../../../bin/CoreData [weitjong@igloo android]$ ls -ltr launcher-app/src/main/assets/ total 0 lrwxrwxrwx. 1 weitjong weitjong 23 Aug 22 18:00 Data -> ../../../../../bin/Data lrwxrwxrwx. 1 weitjong weitjong 27 Aug 22 18:00 Autoload -> ../../../../../bin/Autoload
Thank you! it works for me, I missed the ‘src/main/assets’ part before.
after using mklink to create directory link and removing all ‘*_assets’ like folders in build/intermediates, it successfully produce a 5x M apk and runs well.