Gradle issues setting up new android project

Hi all,

I am running into issues setting up a project with Android. Forgive me, still getting my feet wet.

What I’ve tried so far,

  1. The first issue was related to java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 which from a search looks like it is a gradle mismatch. I tried editing the gradle-wrapper.properties and rerunning gradlew, but this was clobbered by UE4 next time I tried to launch.

  2. The next thing was, could I match the jdk to gradle? I looked up and the gradle version it was requesting was 6.1.1, which only supports JDK up to 13. So I installed that and couldn’t get it working.

Could someone provide an updated list similar to the AndroidSDKRequirements? Android Development Requirements | Unreal Engine 4.27 Documentation since this is missing eg the gradle version, or jdk version, or anything I would need to align.

And if it is the gradle version, how can that be changed? The only summary I found was at Manually Updating Gradle in Unreal Engine (draft) – Life Art Studios from just a few months ago - is this recently broken? The number of steps he had to go through can’t be the actual solution.

Any help would be appreciated,
-Alex

To build for android
Android Studio 4
JRE 8
JDK 8
NDK 21
SDK 29/30

If you have a newer jre or android studio it will croak.

Thanks Chris.

My versions as far as I can tell

  • ndk/21.3.6528147
  • Java/jdk1.8.0_202
  • Android SDK build tools 29.0.2
  • CLI tools 7.0
  • Android API 30 (10.0)
  • Android Studio 4.0.2
  • UE 4.27.2

With this setup I get

LogPlayLevel: > Task :app:compileDebugJavaWithJavac
LogPlayLevel: The following annotation processors are not incremental: lifecycle-compiler-2.0.0.jar (androidx.lifecycle:lifecycle-compiler:2.0.0).
LogPlayLevel: Make sure all annotation processors are incremental to improve your build speed.
LogPlayLevel: Error: Y:\app\src\main\java\com\epicgames\ue4\WebViewControl.java:122: error: cannot find symbol
LogPlayLevel: webView.getSettings().setAppCacheMaxSize( 10 * 1024 * 1024 );
LogPlayLevel: ^
LogPlayLevel: symbol: method setAppCacheMaxSize(int)
LogPlayLevel: location: class WebSettings
LogPlayLevel: Error: Y:\app\src\main\java\com\epicgames\ue4\WebViewControl.java:123: error: cannot find symbol
LogPlayLevel: webView.getSettings().setAppCachePath(GameActivity._activity.getApplicationContext().getCacheDir().getAbsolutePath() );
LogPlayLevel: ^
LogPlayLevel: symbol: method setAppCachePath(String)
LogPlayLevel: location: class WebSettings
LogPlayLevel: Error: Y:\app\src\main\java\com\epicgames\ue4\WebViewControl.java:125: error: cannot find symbol
LogPlayLevel: webView.getSettings().setAppCacheEnabled( true );
LogPlayLevel: ^

There are other issues as well. For example when I updated the android API to 30, it caused an issue where the SDK tools 33.0 were installed, which returns a different error when you try to compile.

-Alex

that all looks right
you also should have
command tools - latest

is this a source build of the html port?

Y:\app\src\main\java\com\epicgames\ue4\WebViewControl.java

is missing a symbol

I believe that the api and sdk have to be the same tho
so api 10 (30) should have sdk 30
or api 9/29 and sdk 29

I ended up fixing it.

What I did, was follow the steps in this stackoverflow

And during this process, keep checking Android Studio periodically. Android Studio or the UE4 batch file or gradle, one of these, was installing different versions of the tools or API. I particularly suspect that any time I added or removed an API version in the SDK Platforms it would change the SDK Tools panel as well.

Getting this running was like threading a needle on an orthogonal plane while the hole moves toward and away from you. You can’t see all the parts but something was messing it up in the backend.

I spent 2 weeks getting my first quest build env set up.
Now I can do it in 2 hours, but
its a slog
once its set up tho
then you are stylin

Unreal Docs are total mess, non of the provided “guides” work. I wonder if they check what they write at all. I’m struggling with this android development setup for two weeks already. And it looks like Epic just doesn’t give a … I’m so tired of this.

the docs suck at explain
oculous ones are just as bad
the uat tool corrupted the ndk on me too
I found it best to do it by hand, the jre8 jdk 8 sdk 30 ndk 21

it is dumb
in Unity you press a button to agree and it builds the whole toolchain for you
AS4, the sdk ndk jdk jre.
There is a utuber GDXR who has a decent guide and a patreon.
But really, none of the tuts is really great and you have to bash about.