1
\$\begingroup\$

I'm fairly new to android game dev but after some months of work I finished making my game in ue4. However, when uploading it to google play on an alpha track and then trying to launch the app, it crashes.

The error itself might be connected to either gradle or proguard (from what I gathered in information over the past 2 days), but as the build.gradle file in unreal projects gets a reset with every fresh build, I can't just edit that.

I've also read in the forums by one unreal dev how you are supposed to add dependencies to the build.gradle by using an "additions.gradle" file, but there was no further documentation about that.

I have already looked up every thread online with a similar problem - yet none of those could solve my problem.

Crash logs:

java.lang.NoClassDefFoundError: 



 at com.google.android.gms.c.c.<clinit> (Unknown Source)

  at com.epicgames.ue4.GameActivity.onCreate (GameActivity.java:2785)

  at android.app.Activity.performCreate (Activity.java:7383)

  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1218)

  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3250)

  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3405)

  at android.app.ActivityThread.-wrap12 (Unknown Source)

  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1994)

  at android.os.Handler.dispatchMessage (Handler.java:108)

  at android.os.Looper.loop (Looper.java:166)

  at android.app.ActivityThread.main (ActivityThread.java:7523)

  at java.lang.reflect.Method.invoke (Native Method)

  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:245)

  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:921)

build.gadle in Intermediate\Android\APK\gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
    apply from: 'buildscriptAdditions.gradle', to: buildscript
}

apply from: 'baseBuildAdditions.gradle'

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle in Intermediate\Android\APK\gradle\permission_library

apply plugin: 'com.android.library'
android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        minSdkVersion 13
        targetSdkVersion 23
    }
}
dependencies {
    implementation 'com.android.support:support-v13:25.0.0'
}

build.gradle in Intermediate\Android\APK\gradle\downloader_library

apply plugin: 'com.android.library'
android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        minSdkVersion 4
        targetSdkVersion 15
        versionCode 2
        versionName "1.1"
    }
}

buildAdditions.gradle in Intermediate\Android\APK\gradle\app

 apply from: 'aar-imports.gradle'
    apply from: 'projects.gradle'
    android {
        defaultConfig {
            ndk {
                abiFilter "arm64-v8a"
            }
        }
        signingConfigs {
            release {
(Keystore removed)
            }
        }
        buildTypes {
            release {
                signingConfig signingConfigs.release
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
            debug {
                debuggable true
            }
        }
    }
    dependencies {
        implementation('com.android.support:support-v13:27.1.0')
    }
    dependencies {
        implementation('com.google.android.gms:play-services-gcm:11.8.0')
    }
\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

so I fixed the problem. I had to go into C:\Program Files\Epic Games\UE_4.21\Engine\Build\Android\Java and edit the aar-imports file. After adding all missing dependencies and updating the others (as many were super outdated) the problem was fixed.

(also make sure the dependencies are the same as those in your plugins build.gradle files.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .