简体   繁体   中英

Android thread exiting with uncaught exception (group=0x4000fe70) Error

Hi I am trying to make a splash screen. I try the code at 2.3 version everything is ok. but when ı try the code at android 2.1 an lower versions, I get an error.

Also I try on the galaxy tab but there is no problem.

How can I sure to my application is runnable other versions of androids.

The errors is on the emulator 1.5

03-09 10:32:20.016: D/AndroidRuntime(841): Shutting down VM
03-09 10:32:20.016: W/dalvikvm(841): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
03-09 10:32:20.016: E/AndroidRuntime(841): Uncaught handler: thread main exiting due to uncaught exception
03-09 10:32:20.026: E/AndroidRuntime(841): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.activities/com.activities.SplashScreenActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class java.lang.reflect.Constructor
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.app.ActivityThread.access$1800(ActivityThread.java:112)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.os.Looper.loop(Looper.java:123)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.app.ActivityThread.main(ActivityThread.java:3948)
03-09 10:32:20.026: E/AndroidRuntime(841):  at java.lang.reflect.Method.invokeNative(Native Method)
03-09 10:32:20.026: E/AndroidRuntime(841):  at java.lang.reflect.Method.invoke(Method.java:521)
03-09 10:32:20.026: E/AndroidRuntime(841):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
03-09 10:32:20.026: E/AndroidRuntime(841):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
03-09 10:32:20.026: E/AndroidRuntime(841):  at dalvik.system.NativeStart.main(Native Method)
03-09 10:32:20.026: E/AndroidRuntime(841): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class java.lang.reflect.Constructor
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.view.LayoutInflater.createView(LayoutInflater.java:512)
03-09 10:32:20.026: E/AndroidRuntime(841):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
03-09 10:32:20.026: E/AndroidRuntime(841):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.app.Activity.setContentView(Activity.java:1626)
03-09 10:32:20.026: E/AndroidRuntime(841):  at com.activities.SplashScreenActivity.onCreate(SplashScreenActivity.java:33)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
03-09 10:32:20.026: E/AndroidRuntime(841):  ... 11 more
03-09 10:32:20.026: E/AndroidRuntime(841): Caused by: java.lang.reflect.InvocationTargetException
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.widget.LinearLayout.<init>(LinearLayout.java:92)
03-09 10:32:20.026: E/AndroidRuntime(841):  at java.lang.reflect.Constructor.constructNative(Native Method)
03-09 10:32:20.026: E/AndroidRuntime(841):  at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.view.LayoutInflater.createView(LayoutInflater.java:499)
03-09 10:32:20.026: E/AndroidRuntime(841):  ... 21 more
03-09 10:32:20.026: E/AndroidRuntime(841): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f020016 a=-1 r=0x7f020016}
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.content.res.Resources.loadDrawable(Resources.java:1609)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.view.View.<init>(View.java:1725)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.view.View.<init>(View.java:1674)
03-09 10:32:20.026: E/AndroidRuntime(841):  at android.view.ViewGroup.<init>(ViewGroup.java:271)
03-09 10:32:20.026: E/AndroidRuntime(841):  ... 25 more

The code par is;

super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_splash_screen);

        tv = (TextView) findViewById(R.id.LoadingBarTextView);
    loadTextID = 1;


splashTextHandler = new Handler() {
        public void handleMessage(Message msg2) {
            if (loadTextID == 1) {
                tv.setText("Loading..");
                loadTextID = 2;
            } else if (loadTextID == 2) {
                tv.setText("Loading...");
                loadTextID = 3;
            } else {
                tv.setText("Loading.");
                loadTextID = 1;
            }
        }
    };
Thread splashTread = new Thread() {
        @Override
        public void run() {
            try {
                int waited = 0;
                while (isActive && (waited < splashTime1)) {
                    sleep(500);
                    if (isActive) {
                        waited += 500;
                        splashTextHandler.sendMessage(splashTextHandler
                                .obtainMessage());
                    }
                }

            } catch (InterruptedException e) {
                // do nothing
            } finally {
                /*
                finish();
                Intent i = new Intent();
                i.setClassName("com.activities",
                        "com.activities.DashboardActivity");
                startActivity(i);
                */
            }
        }
    };
    splashTread.start();

What is the problem ?

this line

 03-09 10:32:20.026: E/AndroidRuntime(841): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.activities/com.activities.SplashScreenActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class java.lang.reflect.Constructor

There must be an xml tag in your manifest file which may not have specific name="attribute" . Try to check if you are using such a tag but not defining a crucial name/attribute, possibly the parent attribute.

I think ur using 9 patch drawable . if so then try with normal images for <= 2.1V

From ur logcat:

Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f020016 a=-1 r=0x7f020016}

It would be more clear if you post your xml file, but I think you are trying to use a non-drawable resource as a drawable item. for example this: view.setBackground(R.id.something)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM