Reputation: 1288
When I change the:
android:icon="@drawable/ic_launcher"
to
android:icon="@drawable/yellow_sun_symbol"
The app crashes instantly upon launch. I have already placed the different resolution pictures in the drawable folders with the correct name.
Can anyone remedy my issue?
Thanks for your help in advance
EDIT:
The logcvat file shows this:
12-19 08:31:23.145: W/dalvikvm(22525): threadid=1: thread exiting with uncaught exception (group=0x40d402a0)
12-19 08:31:23.150: E/AndroidRuntime(22525): FATAL EXCEPTION: main
12-19 08:31:23.150: E/AndroidRuntime(22525): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.zstock/com.example.zstock.MainActivity}: android.view.InflateException: Binary XML file line #30: Error inflating class com.android.internal.widget.ActionBarView
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.app.ActivityThread.access$600(ActivityThread.java:140)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.os.Handler.dispatchMessage(Handler.java:99)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.os.Looper.loop(Looper.java:137)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.app.ActivityThread.main(ActivityThread.java:4898)
12-19 08:31:23.150: E/AndroidRuntime(22525): at java.lang.reflect.Method.invokeNative(Native Method)
12-19 08:31:23.150: E/AndroidRuntime(22525): at java.lang.reflect.Method.invoke(Method.java:511)
12-19 08:31:23.150: E/AndroidRuntime(22525): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
12-19 08:31:23.150: E/AndroidRuntime(22525): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
12-19 08:31:23.150: E/AndroidRuntime(22525): at dalvik.system.NativeStart.main(Native Method)
12-19 08:31:23.150: E/AndroidRuntime(22525): Caused by: android.view.InflateException: Binary XML file line #30: Error inflating class com.android.internal.widget.ActionBarView
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-19 08:31:23.150: E/AndroidRuntime(22525): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3019)
12-19 08:31:23.150: E/AndroidRuntime(22525): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3079)
12-19 08:31:23.150: E/AndroidRuntime(22525): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:304)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.app.Activity.setContentView(Activity.java:1924)
12-19 08:31:23.150: E/AndroidRuntime(22525): at com.example.zstock.MainActivity.onCreate(MainActivity.java:13)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.app.Activity.performCreate(Activity.java:5206)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
12-19 08:31:23.150: E/AndroidRuntime(22525): ... 11 more
12-19 08:31:23.150: E/AndroidRuntime(22525): Caused by: java.lang.reflect.InvocationTargetException
12-19 08:31:23.150: E/AndroidRuntime(22525): at java.lang.reflect.Constructor.constructNative(Native Method)
12-19 08:31:23.150: E/AndroidRuntime(22525): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
12-19 08:31:23.150: E/AndroidRuntime(22525): ... 25 more
12-19 08:31:23.150: E/AndroidRuntime(22525): Caused by: java.lang.OutOfMemoryError
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:623)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:476)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.content.res.Resources.loadDrawable(Resources.java:1963)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.content.res.Resources.getDrawable(Resources.java:672)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.app.ApplicationPackageManager.getDrawable(ApplicationPackageManager.java:641)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:151)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.content.pm.ComponentInfo.loadDefaultIcon(ComponentInfo.java:167)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:156)
12-19 08:31:23.150: E/AndroidRuntime(22525): at android.app.ApplicationPackageManager.getActivityIcon(ApplicationPackageManager.java:674)
12-19 08:31:23.150: E/AndroidRuntime(22525): at com.android.internal.widget.ActionBarView.<init>(ActionBarView.java:222)
12-19 08:31:23.150: E/AndroidRuntime(22525): ... 28 more
I have spell checked the XML and everything is fine, no red lines anywhere. The file I am using is called 'yellow_sun_symbol' and it is located in all of the drawable folders under the same name, but with different resolutions.
The AndroidManifest.xml is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.zstock"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/yellow_sun_symbol"
android:label="@string/app_name"
android:theme="@style/Theme.Sweetorange" >
<activity
android:name="com.example.zstock.MainActivity"
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>
When I change the @drawable/yellow_sun_symbol to @drawable_ic_launcher it works fine. There is probably some minor detail that I am missing here since I'm a total beginner at this.
Thanks in advance once more!
Upvotes: 2
Views: 1978
Reputation: 26
from console: run "ant clean" or manualy delete "bin" and "gen" directories from project dir
Upvotes: 1