Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve symbol KITKAT Cannot Resolve method getAllocationByteCount()

Tags:

android

I am trying to run "BitmapFun" official example but getting the following errors:

1)Cannot resolve symbol KITKAT 2) Cannot resolve method getAllocationByteCount()

Any help ?

My AndroidManifest.xml :

<uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="19" />

and here is the code :

 @TargetApi(VERSION_CODES.KITKAT)
public static int getBitmapSize(BitmapDrawable value) {
    Bitmap bitmap = value.getBitmap();

    // From KitKat onward use getAllocationByteCount() as allocated bytes can potentially be
    // larger than bitmap byte count.
    if (Utils.hasKitKat()) {
        return bitmap.getAllocationByteCount();
    }

    if (Utils.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }

    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}
like image 291
Vishwas Avatar asked Dec 04 '13 09:12

Vishwas


1 Answers

You'll need to set the build SDK version to 19 (4.4) or higher to have API level 19 symbols available while compiling.

First, use the SDK Manager to download API 19 if you don't have it yet.

Then, configure your project to use API 19:

  • In Android Studio: File -> Project Structure -> General Settings -> Project SDK.

  • In Eclipse ADT: Project Properties -> Android -> Project Build Target

like image 182
laalto Avatar answered Sep 29 '22 17:09

laalto