Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid int on xml Android color file when launched on a galaxy tab

Tags:

android

I have a crash on my android app when I try to launch it on a Galaxy Tab with android 4.1.2. The error is:

09-26 21:06:10.293: E/AndroidRuntime(9596): Caused by: java.lang.NumberFormatException: Invalid int: "res/color/tw_primary_text_holo_dark.xml"

This error doesn't appears on a galaxy s4 with Android 4.2.2 and also on the emulator (phone or tab screen size) with Android 4.1.1.

I've tried to find this tw_primary_text_holo_dark.xml file and I can't find it. But there is obvisouly in a primary_text_holo_dark.

Do you have an idea why this appears only on my tab?

like image 786
Ant-1 Avatar asked Sep 26 '13 19:09

Ant-1


3 Answers

I had the same problem and it was caused by using the tint attribute combined with an color selector on a Galaxy Tab device:

<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:tint="@color/tab_color_selector" />

The only solution seems to be to create a custom imageview as described here: Android imageview change tint to simulate button click

like image 65
Daniel Veihelmann Avatar answered Nov 17 '22 00:11

Daniel Veihelmann


I ran into this same problem, also on a Galaxy Tab. The problem turned out to be in one of my resource files, which was a copy of simple_list_item_1.xml from the official android repository, but with the background color changed. The property in there that was causing the problem was

android:paddingStart="?android:attr/listPreferredItemPaddingStart"

but using android:paddingStart="5dip" also caused the same crash. Using android:paddingLeft="5dip" works fine.

like image 23
Jesse Crocker Avatar answered Nov 16 '22 23:11

Jesse Crocker


Occasionally, errors such as those that rise up on me are resolved after a clean of my project and a rebuild on the device. Sometimes I feel as though the system just gets itself in a bad state and still is trying to reference something that was previous a different asset than it was expecting.

Otherwise, if this is a standing issue beyond that, not sure. There are some minor differences that I have found in the software side between versions of Jellybean and you might have found one here.

like image 1
Jay Snayder Avatar answered Nov 16 '22 23:11

Jay Snayder