Complaints while in init phase

I recently started getting these complaints during the init phase of the application:


It says the app does not respond and offers to kill the app.

The only change I did is move from Ant to Gradle - which I regret for multiple reasons since it seems to slow down compiling and I am a very impatient guy.

While not related to your problem. Ant to Gradle is the right thing to do :slight_smile: Though it should be faster typically. First time probably slower since with Ant you have manually downloaded all the dependencies and Gradle needs to do it separately. After that they are cached for some time and all the other changes are cleverly scanned resulting in lot less operations on normal iterative builds.

So once your immediate anger has cooled down, I would suggest spending a bit of time figuring out why it is slower. Again, as it shouldn’t.

To your problem… Your app init phase, meaning that everything is ready to go and app is actually executed? jVisualVM to the rescue. Is the app blocked on some I/O?

Gradle will always compile faster. ANT can only submit all “timestamp changed” .java files to Javac and hope it sorts out dependencies while gradle keeps a detailed dependency graph and has a better idea what to actual compile (I essentially never have to do a ‘clean build’ with gradle while it’s routine with ANT or maven).

Gradle also keeps some daemons around in the background to do multi-process compiles and that even avoids the latency of .exe startup.

Before tarring and feathering gradle, you should make sure that it’s not your IDE causing the issue by running gradle from the command line. While effectively it may make no difference in how you proceed, at least you would know which tool to boil the tar for. In my own day-to-day life, I’m really sad when I have to use other build tools for my day job. I miss “gradle run” a lot.

Caveat: if your project is setup in such a way that it is going to rebundle your assets every time then that could slow things down… but that’s not a tool difference, that’s a build config difference. The default ANT projects have a separate assets directory and can run without bundling them. For example, you would see crazy slow gradle launch times if you write a new resource to your assets every time you build.

As to the other, it seems like the init phase of your application is taking long enough that the OS thinks your application has ‘hung’. You may be loading too many things during simpleInit()/appState.init… maybe some could be moved to background threads. It’s also possible that this is true no matter how you launch the app but that running with gradle is different enough that the OS expects events to start processing sooner.

A similar but different example is when Mythruna is starting up, if I don’t move the mouse or try to use the keyboard then Windows never complains but if I try to move the window and/or do a bunch of mouse events over the app during simpleInit() then eventually it will complain (at minimum in the title bar but I’ve seen it popup the “App not responding” dialog, too.)

1 Like

Not sure why Gradle might make issue, but:

You can always use SDK just for assets.
While code in Intellij or raw Netbeans or any IDE you like.

To help you properly, please let us know these things:

  1. The platform and architecture you are running the app on.
  2. The Stacktrace (if there are any).

Also, first gradle wrapper run will be slow (if not very slow) because it starts the gradle daemon, while subsequent runs shouldn’t be slow unless the IDE is tearing your resources down.