New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hushicai opened this Issue Nov 8, 2017 · 8 comments

Comments

Projects
None yet
6 participants
@hushicai

hushicai commented Nov 8, 2017

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)
 

@marcioadr88

This comment has been minimized.

marcioadr88 commented Nov 8, 2017

I have the same problem on android 7.0 with RN 0.48.4

@kbarralon

This comment has been minimized.

kbarralon commented Nov 8, 2017

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>
@hushicai

This comment has been minimized.

hushicai commented Nov 8, 2017

@kbarralon I solved the problem in the same way.

@marcioadr88

This comment has been minimized.

marcioadr88 commented Nov 8, 2017

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

@hushicai

This comment has been minimized.

hushicai commented Nov 9, 2017

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

@ismjt

This comment has been minimized.

ismjt commented Nov 9, 2017

@kbarralon Thanks!

@OrangeFlavoredColdCoffee

This comment has been minimized.

OrangeFlavoredColdCoffee commented Nov 10, 2017

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

@christophermark

This comment has been minimized.

Contributor

christophermark commented Nov 13, 2017

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