Question

I am trying to build my 1st android app. But their is problem that Photoshop images are not working as a background image of my app. I tried Paint and the images I make in Paint are working quiet well. But images of Photoshop are not working. I've used CS5, CS5.5 and even CS3. Tried a lot of images but none of them worked. Here is an XML code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/po"> // po is the name of image

I even tried relative layout. I also tried to put the images in all drawable folders. Eclipse shows no error in XML. It's working fine. But when I open graphical layout the background is not their. This is the error message which i see in graphical layout:

Failed lot load D:\Other\Photoshop\New folder\Myapp\res\drawable-hdpi\po.jpg
Exception details are logged in Window > Show View > Error Log



javax.imageio.IIOException: Unsupported Image Type
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(    at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(    at javax.imageio.ImageIO.read(    at javax.imageio.ImageIO.read(    at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:118)
    at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:102)
    at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:233)
    at android.content.res.BridgeTypedArray.getDrawable(BridgeTypedArray.java:782)
    at android.view.View.<init>(View.java:3554)
    at android.view.ViewGroup.<init>(ViewGroup.java:470)
    at android.widget.LinearLayout.<init>(LinearLayout.java:176)
    at android.widget.LinearLayout.<init>(LinearLayout.java:172)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(    at sun.reflect.NativeConstructorAccessorImpl.newInstance(    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(    at java.lang.reflect.Constructor.newInstance(    at android.view.LayoutInflater.createView(LayoutInflater.java:594)
    at android.view.BridgeInflater.onCreateView(BridgeInflater.java:86)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:131)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:373)

I also tried PNG images, but they are also not working.

Here are the properties of image:

Dimensions 480*600
resolution 300 dpi
resolution unit 2
format     jpg
size       705 kb
Was it helpful?

Solution

Android built-in bitmap decoder does not support JPEG images with CMYK colorspace. Convert/save the images with RGB colorspace.

OTHER TIPS

Do you have a drawable folder? Or only drawable folders with limiters, such as drawable-hdpi?

It could be the device or emulator does not fall into any of the limiting categories.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top