I want to create a new version of my app that caters to the needs of users
with Android 1.5/1.6/2.0 devices and move ahead with the normal version of
my app. For that I copied my app directory then applied the Rename
Application Package refactoring. That helped a lot. So far I mostly had to
fix references to styles.
Unfortunately I cannot launch the app. I get the following stacktrace:
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.newsrob.threetosix/com.newsrob.DashboardListActivity}:
android.view.InflateException: Binary XML file line #31: Error inflating
class java.lang.reflect.Constructor
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
at android.app.ActivityThread.access$1800(ActivityThread.java:112)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3948)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #31: Error
inflating class java.lang.reflect.Constructor
at android.view.LayoutInflater.createView(LayoutInflater.java:512)
at
com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
at android.app.Activity.setContentView(Activity.java:1626)
at
com.newsrob.DashboardListActivity.onCreate(DashboardListActivity.java:45)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at android.widget.TextView.<init>(TextView.java:308)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:499)
... 24 more
Caused by: android.content.res.Resources$NotFoundException: File
res/drawable/label_background.xml from color state list resource ID #0x0
at android.content.res.Resources.loadColorStateList(Resources.java:1744)
at android.content.res.TypedArray.getColorStateList(TypedArray.java:289)
at android.widget.TextView.<init>(TextView.java:608)
... 28 more
The little sense I can make of this tells me that it may have two causes.
(a) The source of the issue is in line #31.
(b) There is an issue accessing res/drawable/label_background.xml.
Here are excerpts of the layout xml that I think is causing the issue:
?xml version="1.0" encoding="utf-8"?>
[..]
<LinearLayout
android:id="@+id/status_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
* android:background="@drawable/label_background" <<<--- Line #21*
android:visibility="gone">
<LinearLayout
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/control_panel_title"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
[..]
*android:textColor="?lightTextColor" /> <<<--- Line #31*
<ProgressBar
android:id="@+id/progress_status_bar"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:visibility="invisible" />
</LinearLayout>
</LinearLayout>
[..]
When I comment out Line #21 the error is not raised. That would be cause (b)
then I suppose.
I do have a file however that is called
app/res/drawable/label_background.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:startColor="#f666"
android:centerColor="#f222"
android:endColor="#f000" />
</shape>
And it is accessible also:
newsrob $ ls -l app/res/drawable/label_background.xml *(old app)*
-rw-r--r-- 1 mkamp staff 432 Nov 17 18:59
app/res/drawable/label_background.xml
newsrob $ ls -l app-threetosix/res/drawable/label_background.xml *(new app)*
-rw-r--r-- 1 mkamp staff 267 Feb 16 16:39
app-threetosix/res/drawable/label_background.xml
When I comment out Line #31 the error is also not raised, and that would be
cause (a) then.
However this worked before. I have a app/res/values/attrs.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
[..]
<attr
name="lightTextColor"
format="color" />
[..]
</resources>
And a app/res/values/theme.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
[..]
<style name="Theme.NewsRob_Light_Normal"
parent="android:style/Theme.Light">
[..]
<item name="lightTextColor">#fff</item>
[..]
</style>
<style name="Theme.NewsRob_Dark_Normal"
parent="android:style/Theme.Black">
<item name="lightTextColor">#999</item>
[..]
</style>
[..]
</resources>
Any ideas why that is not working anymore, respectively how to work out what
the actual cause is?
Best,
Mariano
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en