Android library integration very slow,
Hi,
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: https://forum.unity.com/threads/integration-unity-as-a-library-in-native-android-app-version-2.751712/ 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!
We are experiencing similar issues. If anyone has found a solution, let's hear it!
Answer by dorukhanakar · Jul 21, 2020 at 11:00 AM
Hello change your build.gradle (Module: app) file like this its work for me.
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "blabla.com.tr"
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'), 'proguard-rules.pro'
}
}
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:!*~"
}
}
You're my hero! Adding
aaptOptions {
noCompress = ['.unity3d', '.ress', '.resource', '.obb']
ignoreAssetsPattern = "!.git:!.ds_store:!thumbs.db:!*~"
}
to my Android app's app/build.gradle
fixed it for me.
Your answer
Follow this Question
Related Questions
Integrate Unity3D AR application in android and iOS application 0 Answers
Prepare Unity without showing UnityPlayer 0 Answers
Game runs slower on Android without performance issues. 3 Answers
Couldn't integrate UnityAds in cocos2d-x Android via Eclipse 0 Answers
Import Unity project in already built Android Project 0 Answers