dungeon-crawl-android icon indicating copy to clipboard operation
dungeon-crawl-android copied to clipboard

Can't build the project with the current tools

Open sidav opened this issue 6 months ago • 3 comments

I wanted to upgrade Crawl version for my fork of your repo. Previously I did this successfully (back when there was CrystaX NDK being used - both upgrade to 0.23 and downgrade to 0.14.2 were successful), but this time I couldn't even get the current version (without code changes) to run.

The steps I took:

  • Installed Android Studio, SDK, etc
  • Cloned the repo
  • Ran setup.sh, no problems there
  • Opened the repo in android studio
  • Got this:
Your build is currently configured to use incompatible Java 21.0.6 and Gradle 7.5. Cannot sync the project.

We recommend upgrading to Gradle version 8.12.

The minimum compatible Gradle version is 8.5.

The maximum compatible Gradle JVM version is 18.

Possible solutions:
 - Upgrade to Gradle 8.12 and re-sync
  • Agreed. Upgraded to gradle 8.12. Studio downloaded the NDK and stuff.
  • During the product build steps I get this: java.lang.NullPointerException: Cannot invoke "String.length()" because "<parameter1>" is null. That's it, literally not a single line more than that, no backtrace, nothing. The step itself is dexBuilderDebug, and it points me to CrawlKeyboardView$1.class and CrawlKeyboardWrapper$SpecialKey.class. Build steps also list an error in CrawlKeyboardView$3.class, and the error description window shows a ton of mystic arcane lines of knowledge for which I don't have enough intelligence stat to comprehend. They start with:
Execution failed for task ':dexBuilderDebug'.
> There were multiple failures while executing work items
   > A failure occurred while executing com.android.build.gradle.internal.dexing.DexWorkAction
      > Failed to process: /home/sidav/android/dungeon-crawl-android/build/intermediates/javac/debug/classes

From my very limited knowledge in Android development I assume the following:

  • Java part of the app is built correctly, as the error lists .class file and not .java file.
  • Native part is build correctly, as I only get warnings and no errors on NDK build step.
  • It fails somewhere in .class -> .dex conversion because God knows why.
  • My current suspect for the root of the problem is SpecialKey enum, as its constructor does getCodeToKeyMap().put(code, this); and it looks as if it's being called by dex builder before enum values themselves are processed. But I'm absolutely not sure.

What am I doing wrong?

sidav avatar Jun 05 '25 23:06 sidav

After installing older SDK and tweaking the build.gradle (changing min SDK version and adding a namespace), I got it to run. Yay! There's another problem now: severe problems after merging 0.33.1 into android branch. I'm getting C compilation errors, missing .h files (they've added job_gen.py) and even after resolving all this the app just crashes after loading. Well...

sidav avatar Jun 18 '25 23:06 sidav

I think I've managed to resolve the 0.33.1 build. The thing is, current android tiles port added a ton of #ifdef __ANDROID__ which messes with build by adding SDL and stuff where it is not needed. #undef helps to resolve this. Also there is now job-gen.py scripts required to be run before build. I'm leaving this issue open because the newest SDK is still not compatible with the current java code. Btw, thanks for updating the port, current build process is much more comfortable than using CrystaX.

sidav avatar Jun 20 '25 10:06 sidav

Here's my draft-ish release with problems and solutions explained. https://github.com/sidav/dungeon-crawl-android/releases/tag/0.33.1-android-sidav-release I'm not sure I did everything correctly and that's why it's not a PR.

sidav avatar Jun 23 '25 22:06 sidav