Issue
I have the following error when starting an Activity
on Android 5
(on a Nexus 5
).
10-23 10:39:43.218 6823-6823/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: eu.elios.gpstracker.app, PID: 6823
java.lang.RuntimeException: Unable to start activity ComponentInfo{eu.elios.gpstracker.app/eu.elios.gpstracker.app.MessageListActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f070045 type #0x1d is not valid
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f070045 type #0x1d is not valid
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2603)
at android.content.res.Resources.getXml(Resources.java:1098)
at android.transition.TransitionInflater.inflateTransition(TransitionInflater.java:75)
at com.android.internal.policy.impl.PhoneWindow.getTransition(PhoneWindow.java:3696)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3649)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:367)
at android.app.Activity.setContentView(Activity.java:2144)
at eu.elios.gpstracker.app.MessageListActivity.onCreate(MessageListActivity.java:81)
By looking at the Resource ID
on R I found that the resource is the color I use for my android:colorAccent
in:
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primaryDark</item>
<item name="android:colorBackground">@color/background</item>
<item name="android:colorAccent">@color/accent</item>
<item name="android:colorControlHighlight">@color/controlHighlight</item>
<item name="android:navigationBarColor">?android:colorPrimaryDark</item>
<item name="android:statusBarColor">?android:colorPrimaryDark</item>
<item name="android:windowBackground">?android:colorBackground</item>
</style>
The Resource
itself is:
<color name="accent">@color/md_deep_orange_500</color>
<color name="md_deep_orange_500">#ff5722</color>
By changing the Color
to some other colors (like @color/primaryDark
) I get the same error but with the ID
of the new color.
Am I missing something?
Solution
Try explicitly adding the alpha value i.e.
<color name="md_deep_orange_500">#ffff5722</color>
Answered By - crafty
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.