Hello,
I have my first experience with CircleCi and faced with the issue to run tests on Android emulator. All tests are passed successfully on the local machine but on the server side it fails with OOM.
OOM is caused by assign drawable to imageview:
java.lang.OutOfMemoryError: Failed to allocate a 21233676 byte allocation with 4194304 free bytes and 13MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:988)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2474)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.Resources.getDrawable(Resources.java:787)
at android.content.Context.getDrawable(Context.java:403)
at android.support.v4.content.ContextCompatApi21.getDrawable(ContextCompatApi21.java:26)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:321)
at android.support.v7.widget.TintManager.getDrawable(TintManager.java:175)
at android.support.v7.widget.TintManager.getDrawable(TintManager.java:168)
at android.support.v7.widget.AppCompatImageHelper.setImageResource(AppCompatImageHelper.java:51)
at android.support.v7.widget.AppCompatImageView.setImageResource(AppCompatImageView.java:72)
at com.clientdomain.fragment.HomeFragment.onCreateView(HomeFragment.java:130)
Does application hits limitation by memory? If yes is it limitation of environment or limitation of avd device? Do you have any others thoughts what is root cause of this issue and how it can be fixed?
I tried different variants and my final config file looks as this:
machine:
environment:
_JAVA_OPTIONS: "-Xms1024m -Xmx2048m"
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"'
test:
override:
- echo no | android create avd -n custom-android22-googleapis -t "android-22" --abi default/armeabi-v7a -c 1024M
- android list avd
- emulator -avd custom-android22-googleapis -no-audio:
background: true
parallel: true