milosmns / actual-number-picker

Android: A horizontal number picker
GNU General Public License v3.0
222 stars 36 forks source link

W/View: ActualNumberPicker not displayed because it is too large to fit into a software layer (or drawing cache), needs 15322800 bytes, only 14745600 available #11

Closed yaturner closed 7 years ago

yaturner commented 7 years ago

here is the relevant portion of my XML <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginTop="5.5dp" android:weightSum="2">

        <me.angrybyte.numberpicker.view.ActualNumberPicker
            android:id="@+id/my_account_card_month_picker"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="22.5dp"
            android:layout_weight="1"
            android:layerType="software"
            app:show_bars="false"
            app:max_value="12"
            app:min_value="1"
            app:show_controls="true"
            app:show_fast_controls="false"
            app:show_text="true"
            app:text_color="@android:color/black"
            app:text_size="16sp" />

        <me.angrybyte.numberpicker.view.ActualNumberPicker
            android:id="@+id/my_account_card_year_picker"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layerType="software"
            app:show_bars="false"
            app:max_value="12"
            app:min_value="1"
            app:show_controls="true"
            app:show_fast_controls="false"
            app:show_text="true"
            app:text_color="@android:color/black"
            app:text_size="16sp" />

    </LinearLayout>

here is my build.gradle

android { compileSdkVersion 23 buildToolsVersion "24.0.1"

defaultConfig {
    applicationId "android.fusionofideas.com.uscca"
    minSdkVersion 17
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:design:23.2.0' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.google.android.gms:play-services-base:9.8.0+' compile 'com.google.android.gms:play-services-location:9.8.0+' compile 'com.google.android.gms:play-services-maps:9.8.0+' compile 'com.koushikdutta.ion:ion:2.1.9' compile 'se.emilsjolander:stickylistheaders:2.7.0' compile 'com.github.barteksc:android-pdf-viewer:2.4.0' compile 'com.github.delight-im:Android-SimpleLocation:v1.0.1' compile 'com.github.arimorty:floatingsearchview:2.0.3' compile 'me.angrybyte.picker:picker:1.2.0' }

can you help me? I am using your software in an aar generated from the github source thank you

milosmns commented 7 years ago

Seems like you lost a lot of memory somewhere. The picker is an extremely low-memory component, only using what you give it. Can you analyze your heap and check RAM usage to see what ate your memory?

For example:

https://developer.android.com/studio/profile/investigate-ram.html https://developer.android.com/studio/profile/am-hprof.html

You should be able to detect which objects caused your drain, and fix accordingly.

milosmns commented 7 years ago

Alternatively, you can try setting the large heap attribute in your AndroidManifest. Link: http://stackoverflow.com/a/11275719/2102748

mathias21 commented 7 years ago

Hi @yaturner

I'm also using the library and I'm not getting that error. As @milosmns said, it looks like you are leaking memory somewhere.

I can see you are working with squareup.picasso, maybe you are caching images somewhere and that could be the problem. Just a hint ;)

yaturner commented 7 years ago

thank you, I will check my memory usage

milosmns commented 7 years ago

Sure, report back when you have more info. ^^

yaturner commented 7 years ago

I am using a memory cache for my bitmaps, I will try reducing the amount of memory I allocate to it

milosmns commented 7 years ago

Yep, it's most likely your memory cache, or large bitmaps. Nothing we can workaround from our side.

mathias21 commented 7 years ago

So is this a real issue then?