Application works in debug / run from Eclipse, but .APK gives .classNotFoundException when parsing XML layout that contains a custom View
<p>My application will debug and run perfectly fine on my target device (HTC Desire HD) when the application is installed via USB from Eclipse. </p>

<p>However, when I export to .APK and then install this .APK on my Desire HD (having first manually uninstalled the previous installation of my application), it crashes. </p>

<p>Having inspected the error in Logcat I can see that a custom extended <code>View</code> of mine, that is referenced using its fully-qualified name in a layout XML file, apparently cannot be found and leads to a <code>.classNotFoundException</code>. </p>

<p>The two lines of interest from the Logcat error trace are:</p>

<p><code>04-09 21:29:01.101: E/AndroidRuntime(2157): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class com.trevp.myAppName.DashboardLayout</code></p>

<p>And further below:</p>

<p><code>04-09 21:29:01.101: E/AndroidRuntime(2157): Caused by: java.lang.ClassNotFoundException: com.trevp.myAppName.DashboardLayout in loader dalvik.system.PathClassLoader[/data/app/com.trevp.myAppName-1.apk</code></p>

<p>This crash does not occur when the application is installed from Eclipse, only when installed from an exported .APK. </p>

<p>In case this could be a Proguard issue, here is my Proguard configuration file. I haven't really touched it from default, as I'm new to using Proguard. My Proguard version is 4.7.</p>

<pre><code>-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native &lt;methods&gt;;
}

-keepclasseswithmembernames class * {
    public &lt;init&gt;(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public &lt;init&gt;(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}
</code></pre>

<p>The XML file that is being inflated. (<code>Merge</code> tags are used because the elements within are added as children to the parent <code>FrameLayout</code>.)</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;merge xmlns:android="http://schemas.android.com/apk/res/android"&gt;

    &lt;ImageView   
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="top|left"
    android:scaleType="centerCrop"
    android:id="@+id/dashLayoutImage"
    android:src="@drawable/background2" android:drawingCacheQuality="high"/&gt;

    &lt;com.trevp.myAppName.DashboardLayout
    android:clipChildren="false"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/dashLayout"
    android:layout_gravity="top|left" /&gt;

    &lt;include
    android:layout_gravity="top|left"
    layout="@layout/status_bar"
    android:id="@+id/statusBar" /&gt;

    &lt;TextView
    android:layout_gravity="bottom|left"
    android:id="@+id/pollRate"
     android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    &gt;
    &lt;/TextView&gt;

&lt;/merge&gt;
</code></pre>

<p>Thanks in advance for any tips on this. Please shout if there are any other extracts or configuration information required. </p>
