Java 安卓应用程序错误安装时应用程序正在崩溃

Java 安卓应用程序错误安装时应用程序正在崩溃,java,android,xml,Java,Android,Xml,日志文件:- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.nxtgendataingestion/com.example.android.nxtgendataingestion.SplashScreen}: java.lang.IllegalArgumentException: Unknown color at android.app.ActivityThre

日志文件:-

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.nxtgendataingestion/com.example.android.nxtgendataingestion.SplashScreen}: java.lang.IllegalArgumentException: Unknown color
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2423)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
    at android.app.ActivityThread.access$900(ActivityThread.java:153)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5438)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
Caused by: java.lang.IllegalArgumentException: Unknown color
    at android.graphics.Color.parseColor(Color.java:226)
    at com.example.android.nxtgendataingestion.SplashScreen.onCreate(SplashScreen.java:24)
    at android.app.Activity.performCreate(Activity.java:6303)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
    ... 9 more
SplashScreen.java:-

package com.example.android.nxtgendataingestion;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import gr.net.maroulis.library.EasySplashScreen;

public class SplashScreen extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EasySplashScreen config = new EasySplashScreen(SplashScreen.this)
                .withFullScreen()
                .withTargetActivity(MainActivity.class)
                .withSplashTimeOut(5000)
                .withBackgroundColor(Color.parseColor("#ebedef"))
                .withHeaderText("WELCOME")
                .withAfterLogoText("Tour Guide App");
        //Set Text Color
        config.getHeaderTextView().setTextColor(android.graphics.Color.parseColor("#239b56f"));
        config.getAfterLogoTextView().setTextColor(android.graphics.Color.parseColor("#239b56f"));
        View view = config.create();
        setContentView(view);


    }
}
成绩档案:-

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.android.nxtgendataingestion"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    testCompile 'junit:junit:4.12'
    //Add Librry of Splash Screen
    compile 'gr.pantrif:easy-android-splash-screen:0.0.1'
}

当我在智能手机上安装应用程序时,当我单击应用程序图标时,它会崩溃。我认为颜色代码中有错误,但我无法对其进行排序。我已经在互联网上找到了这个答案,但没有找到有效的答案。请帮我排序。提前谢谢。

问题

android.graphics.Color.parseColor("#239b56f") //Wrong color format
分析颜色字符串,并返回相应的color-int。如果无法分析该字符串,则引发IllegalArgumentException异常。支持的格式包括:

RRGGBB AARGGBB 使用十六进制字符串。示例

android.graphics.Color.parseColor("#54D66A")

分析颜色字符串,并返回相应的color-int。如果无法分析该字符串,则引发IllegalArgumentException异常。支持的格式有:#RRGGBB#aarggbb'红色'、'蓝色'、'绿色'、'黑色'、'白色'、'灰色'、'青色'、'洋红'、'黄色'、'浅灰色'、'深灰色'

在color.xml中定义颜色并从中提取,因为颜色代码与RGB图案不匹配

.withBackgroundColor(ContextCompat.getColor(this, R.color.your_color);

是的,你的颜色不好
#239b56f
应该是
int alpha,int red,int green,int blue
所以
#11223344
读一下,如果这是一个颜色代码#239b56f,那么我将如何实现它的十六进制代码。@Bunky use
#239b56
。最后删除Character@Bunky
f
在这里是非法的。保持6位十六进制格式。希望这有帮助