Keywords: UE4, Android

Settings

File Permissions

Project Settings -> Platforms -> Android -> APK Packaging -> Uncheck Use ExternalFilesDir for UE4Game files?

Project Settings -> Platforms -> Android -> Advanced APK Packaging -> Extra permissions -> Add android.permission.WRITE_EXTERNAL_STORAGE

How to enable OpenGL ES3.1 and Vulkan

Project Settings -》 Platforms -》 Android -》 Build -》 Support OpenGL ES3.1, By default is using OpenGL ES2.

How to Hide Android App Soft Keys(Home key and Return key, Virtual Keys)

Project Settings -》 Android -》 Platforms -》 Enable FullScreen Immersive on KitKat and above devices

How to change application name of APK

Project Settings -> Platforms -> Android -> Application Display Name(app_name)

Development

Invoke Java code from C++ in UE4

UE4 – Making a Android Plugin in 10 minutes
https://isaratech.com/ue4-making-a-android-plugin-in-10-minutes/

How to request permissions at run-time

Blueprint:

Request Android Permissions

C++:

UAndroidPermissionFunctionLibrary::AcquirePermissions();

Package Issues

BUILD FAILED:gradle\rungradle.bat" :app:assembleDebug

Android APK send to device failed in v4.18, error log:

ExceptionUtils.PrintExceptionInfo: ERROR: cmd.exe failed with args /c "D:\Stage - kornelis\ARcore\HelloARSample 4.18\Intermediate/Android/APK\gradle\rungradle.bat" :app:assembleDebug ExceptionUtils.PrintExceptionInfo: 

Solution 1st (Recommended):
Delete all files, which were the cooked content, under [Project]/intermediate/Android.

Solution 2nd:
1,Double click NVPACK/android-sdk-windows/tools/android.bat;
2,Click “Deselect All”;
3,Check Extras / Android Support Repository, then click Install;

Solution 3rd:
Setup vpn to access google development network to download gradle at first time.

UE4 ERROR: Platform Android is not a valid platform to build

Errors on building:

UE4 ERROR: Platform Android is not a valid platform to build. Check that the SDK is installed properly

Solution 1st:
Kill processs adb.exe.

Solution 2nd:
Delete MyGameBinaries\Win64\UE4Editor-MyGame.dll and rebuild.

Gradle: Run with –stacktrace option to get the stack trace.

Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. Run with –scan to get full insights.

https://qiita.com/EGJ-Kaz_Okada/items/e325c5e2f8807f430076

Error: Could not get resource

Error Log:

A problem occurred configuring root project 'app'.
 > Could not resolve all files for configuration ':classpath'.
    > Could not download kotlin-reflect.jar (org.jetbrains.kotlin:kotlin-reflect:1.1.3-2)
       > Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.1.3-2/kotlin-reflect-1.1.3-2.jar'.
          > Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.1.3-2/kotlin-reflect-1.1.3-2.jar'.
             > Software caused connection abort: recv failed
> Could not download protobuf-java.jar (com.google.protobuf:protobuf-java:3.0.0)
   > Could not get resource 'https://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar'.
      > Could not GET 'https://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar'.
         > Software caused connection abort: recv failed

Solution:
modify config file UE_4.20\Engine\Build\Android\Java\gradle\build.gradle,
add these into build.gradle

jcenter() {
        url "http://jcenter.bintray.com/"
    }

all content:

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

buildscript {
    repositories {
        google()
        jcenter() {
            url "http://jcenter.bintray.com/"
        }
    }
    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
}
Error: Could not get resource

Error Log:

A problem occurred configuring root project 'app'.
 > Could not resolve all files for configuration ':classpath'.
    > Could not download kotlin-reflect.jar (org.jetbrains.kotlin:kotlin-reflect:1.1.3-2)
       > Could not get resource 'http://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.1.3-2/kotlin-reflect-1.1.3-2.jar'.
          > Could not GET 'http://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.1.3-2/kotlin-reflect-1.1.3-2.jar'.
             > Remote host closed connection during handshake
    > Could not download kotlin-stdlib.jar (org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2)
       > Could not get resource 'http://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.jar'.
          > Could not HEAD 'http://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.jar'.
             > Remote host closed connection during handshake
    > Could not download protobuf-java.jar (com.google.protobuf:protobuf-java:3.0.0)
       > Could not get resource 'http://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar'.
          > Could not GET 'http://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar'.
             > Remote host closed connection during handshake
    > Could not download bcpkix-jdk15on.jar (org.bouncycastle:bcpkix-jdk15on:1.56)
       > Could not get resource 'http://jcenter.bintray.com/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.jar'.
          > Could not HEAD 'http://jcenter.bintray.com/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.jar'.
             > Remote host closed connection during handshake
    > Could not download bcprov-jdk15on.jar (org.bouncycastle:bcprov-jdk15on:1.56)
       > Could not get resource 'http://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.jar'.
          > Could not HEAD 'http://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.jar'.
             > Remote host closed connection during handshake
    > Could not download fastutil.jar (it.unimi.dsi:fastutil:7.2.0)
       > Could not get resource 'http://jcenter.bintray.com/it/unimi/dsi/fastutil/7.2.0/fastutil-7.2.0.jar'.
          > Could not HEAD 'http://jcenter.bintray.com/it/unimi/dsi/fastutil/7.2.0/fastutil-7.2.0.jar'.
             > Remote host closed connection during handshake
 * Try:
 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
 * Get more help at https://help.gradle.org

Solution:
Project Settings -> Platforms -> Android -> Uncheck Enable Gradle instead of Ant

Issue: GetTimeStamp return 0 on Android

Look at Android GetTimeStamp local file handling
https://issues.unrealengine.com/issue/UE-93685