Skip to content

Can't convert to color: type=0x1 #123

Closed

Description

@hushicai

It seams that something is wrong in android.

react native: 0.47.2
android: 6.0.1

java.lang.UnsupportedOperationException: Can't convert to color: type=0x1

2 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2423)
3 ......
4 Caused by:
5 java.lang.UnsupportedOperationException:Can't convert to color: type=0x1
6 android.content.res.TypedArray.getColor(TypedArray.java:453)
7 com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:3779)
8 com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:3983)
9 com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:383)
10 android.app.Dialog.setContentView(Dialog.java:515)
11 org.devio.rn.splashscreen.SplashScreen$1.run(SplashScreen.java:32)
12 android.app.Activity.runOnUiThread(Activity.java:5573)
13 org.devio.rn.splashscreen.SplashScreen.show(SplashScreen.java:26)
14 org.devio.rn.splashscreen.SplashScreen.show(SplashScreen.java:47)
15 com.gf.mobile.clickeggs2.MainActivity.onCreate(MainActivity.java:27)
 

Activity

  1. marcioadr88 commented on Nov 8, 2017

    @marcioadr88

    I have the same problem on android 7.0 with RN 0.48.4

  2. kbarralon commented on Nov 8, 2017

    @kbarralon

    I had the same problem. In this file, there is a reference to a primary_dark color.

    So, try to add the primary_dark in res/values/colors.xml (create the file if not exists) :

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
      <color name="primary_dark">#000000</color>
    </resources>
    
  3. hushicai commented on Nov 8, 2017

    @hushicai
    Author

    @kbarralon I solved the problem in the same way.

  4. marcioadr88 commented on Nov 8, 2017

    @marcioadr88

    Thanks, @kbarralon. Adding the reference to "primary_dark" solved the problem. I think this should be an optional step.

  5. hushicai commented on Nov 9, 2017

    @hushicai
    Author

    I had tried it, when downgrade to 3.0.1, It works fine. but 3.0.6 failed without colors.xml

  6. ismjt commented on Nov 9, 2017

    @ismjt

    @kbarralon Thanks!

  7. OrangeFlavoredColdCoffee commented on Nov 10, 2017

    @OrangeFlavoredColdCoffee

    but still error @kbarralon

    Error:Execution failed for task ':react-native-splash-screen:packageReleaseResources'.

    [color/primary_dark] --/node_modules/react-native-splash-screen/android/src/main/res/values/colors.xml [color/primary_dark] /--/node_modules/react-native-splash-screen/android/src/main/res/values/refs.xml: Error: Duplicate resources

    clean not work

    finally i solve by rename ,maybe can help someone

  8. christophermark commented on Nov 13, 2017

    @christophermark
    Contributor

    I've put up a PR to fix this (see #125) which will allow custom theming, but doesn't force it.

    It'll fix the BC break introduced in version 3.0.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions