java - The application has stopped unexpectedly, try again. Android -
i have done beginning of simple android application, ran well, since added pitcure, have error: "the application has stopped unexpectedly, try again". found lot of topic on subject didn't succeed fix mine. it's first real application myself, hope me. in logcat have:
04-18 14:59:13.926: e/androidruntime(331): fatal exception: main 04-18 14:59:13.926: e/androidruntime(331): java.lang.runtimeexception: unable start activity componentinfo{com.example.joignabilite/com.example.joignabilite.identification}: android.view.inflateexception: binary xml file line #2: error inflating class android.widget.relativelayout 04-18 14:59:13.926: e/androidruntime(331): @ android.app.activitythread.performlaunchactivity(activitythread.java:1647) 04-18 14:59:13.926: e/androidruntime(331): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1663) 04-18 14:59:13.926: e/androidruntime(331): @ android.app.activitythread.access$1500(activitythread.java:117) 04-18 14:59:13.926: e/androidruntime(331): @ android.app.activitythread$h.handlemessage(activitythread.java:931) 04-18 14:59:13.926: e/androidruntime(331): @ android.os.handler.dispatchmessage(handler.java:99) 04-18 14:59:13.926: e/androidruntime(331): @ android.os.looper.loop(looper.java:123) 04-18 14:59:13.926: e/androidruntime(331): @ android.app.activitythread.main(activitythread.java:3683) 04-18 14:59:13.926: e/androidruntime(331): @ java.lang.reflect.method.invokenative(native method) 04-18 14:59:13.926: e/androidruntime(331): @ java.lang.reflect.method.invoke(method.java:507) 04-18 14:59:13.926: e/androidruntime(331): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) 04-18 14:59:13.926: e/androidruntime(331): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:597) 04-18 14:59:13.926: e/androidruntime(331): @ dalvik.system.nativestart.main(native method) 04-18 14:59:13.926: e/androidruntime(331): caused by: android.view.inflateexception: binary xml file line #2: error inflating class android.widget.relativelayout 04-18 14:59:13.926: e/androidruntime(331): @ android.view.layoutinflater.createview(layoutinflater.java:518) 04-18 14:59:13.926: e/androidruntime(331): @ com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:56) 04-18 14:59:13.926: e/androidruntime(331): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:568) 04-18 14:59:13.926: e/androidruntime(331): @ android.view.layoutinflater.inflate(layoutinflater.java:386) 04-18 14:59:13.926: e/androidruntime(331): @ android.view.layoutinflater.inflate(layoutinflater.java:320) 04-18 14:59:13.926: e/androidruntime(331): @ android.view.layoutinflater.inflate(layoutinflater.java:276) 04-18 14:59:13.926: e/androidruntime(331): @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:207) 04-18 14:59:13.926: e/androidruntime(331): @ android.app.activity.setcontentview(activity.java:1657) 04-18 14:59:13.926: e/androidruntime(331): @ com.example.joignabilite.identification.oncreate(identification.java:12) 04-18 14:59:13.926: e/androidruntime(331): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 04-18 14:59:13.926: e/androidruntime(331): @ android.app.activitythread.performlaunchactivity(activitythread.java:1611) 04-18 14:59:13.926: e/androidruntime(331): ... 11 more 04-18 14:59:13.926: e/androidruntime(331): caused by: java.lang.reflect.invocationtargetexception 04-18 14:59:13.926: e/androidruntime(331): @ java.lang.reflect.constructor.constructnative(native method) 04-18 14:59:13.926: e/androidruntime(331): @ java.lang.reflect.constructor.newinstance(constructor.java:415) 04-18 14:59:13.926: e/androidruntime(331): @ android.view.layoutinflater.createview(layoutinflater.java:505) 04-18 14:59:13.926: e/androidruntime(331): ... 21 more 04-18 14:59:13.926: e/androidruntime(331): caused by: android.content.res.resources$notfoundexception: resource not drawable (color or path): typedvalue{t=0x1/d=0x7f060001 a=-1 r=0x7f060001} 04-18 14:59:13.926: e/androidruntime(331): @ android.content.res.resources.loaddrawable(resources.java:1681) 04-18 14:59:13.926: e/androidruntime(331): @ android.content.res.typedarray.getdrawable(typedarray.java:601) 04-18 14:59:13.926: e/androidruntime(331): @ android.view.view.<init>(view.java:1951) 04-18 14:59:13.926: e/androidruntime(331): @ android.view.view.<init>(view.java:1899) 04-18 14:59:13.926: e/androidruntime(331): @ android.view.viewgroup.<init>(viewgroup.java:286) 04-18 14:59:13.926: e/androidruntime(331): @ android.widget.relativelayout.<init>(relativelayout.java:173) 04-18 14:59:13.926: e/androidruntime(331): ... 24 more
my activity:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@style/apptheme" android:orientation="horizontal" tools:context=".identification" > <textview android:id="@+id/headerfond" android:layout_width="fill_parent" android:layout_height="40dp" android:background="@drawable/header_band" tools:ignore="selectabletext" /> <textview android:id="@+id/headerlogo2" android:layout_width="40dp" android:layout_height="30dp" android:layout_centerhorizontal="true" android:layout_margintop="5dp" android:background="@drawable/logo2_part2" tools:ignore="selectabletext" /> <textview android:id="@+id/headerlogo1" android:layout_width="80dp" android:layout_height="40dp" android:layout_toleftof="@id/headerlogo2" android:background="@drawable/logo2_part1" tools:ignore="selectabletext" /> </relativelayout>
my identification.java:
package com.example.joignabilite; import android.os.bundle; import android.app.activity; import android.view.menu; public class identification extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_identification); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.identification, menu); return true; } }
and manifest:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.joignabilite" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.example.joignabilite.identification" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> </manifest>
you getting error because of line:
android:background="@style/apptheme"
the background
attribute takes @drawable
, @color
resources. cannot supply style there.
Comments
Post a Comment