Android library integration very slow,


I recently created a project with the intent of embedding it into a native android application. The build that unity produced runs almost immediately after the splash screen. I then followed this example: so I could integrate it into my android application.

When I start the UnityPlayerActivity the splash screen comes immediately but the scene takes a few minutes to load. I stripped the project down but it still takes significantly longer than Unity’s app. I had a look at the profiles and nothing looked suspicious. The library is about 150MB, it uses around 160MB of RAM and the CPU usage stays below 9%.

I have followed a few other examples out there but always to the same result.

I’m very new to android development and quite new to Unity so I’m sure it’s just something fundamental I’m missing.

I have been struggling with this for 2 days now so any advice will be very much appreciated!

Hello change your build.gradle (Module: app) file like this its work for me.

 android {
compileSdkVersion 29
buildToolsVersion "29.0.3"

defaultConfig {
    applicationId ""
    ndk {
        abiFilters 'armeabi-v7a', 'arm64-v8a'
    minSdkVersion 19
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), ''

aaptOptions {
    noCompress = ['.unity3d', '.ress', '.resource', '.obb', 'vuforia/tarsımar.dat', 'vuforia/tarsımar.xml', 'vuforia/vuforiamars_ımages.dat', 'vuforia/vuforiamars_ımages.xml']
    ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"