2d shader not working on Android

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mina1231994

My game uses gles 2.

I found this shader that displays stars with many little white dots on godotshaders website. It works fine on the editor but it shows only the colour when exporting the project to android.

shader_type canvas_item;

uniform vec4 bg_color: hint_color;

float rand(vec2 st) {
    return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123);
}

void fragment() {
    float size = 100.0;
    float prob = 0.9;
    vec2 pos = floor(1.0 / size * FRAGCOORD.xy);
    float color = 0.0;
    float starValue = rand(pos);

    if (starValue > prob)
    {
        vec2 center = size * pos + vec2(size, size) * 0.5;
        float t = 0.9 + 0.2 * sin(TIME * 8.0 + (starValue - prob) / (1.0 - prob) * 45.0);
        color = 1.0 - distance(FRAGCOORD.xy, center) / (0.5 * size);
        color = color * t / (abs(FRAGCOORD.y - center.y)) * t / (abs(FRAGCOORD.x - center.x));
    }
    else if (rand(SCREEN_UV.xy / 20.0) > 0.996)
    {
        float r = rand(SCREEN_UV.xy);
        color = r * (0.85 * sin(TIME * (r * 5.0) + 720.0 * r) + 0.95);
    }
    COLOR = vec4(vec3(color),1.0) + bg_color;
}

I applied the shader to ColorRect and it worked in both Android and Editor. Using GLES2.

ksvslk | 2022-09-02 02:26