アプリケーションは、アプリケーションのインストール時にターゲットデバイス(HTC Desire HD) EclipseからのUSB。アプリケーションはEclipseからdebug/runで動作しますが、.APKはカスタムレイアウトを含むXMLレイアウトを解析するときに.classNotFoundExceptionを返します
ただし、.APKにエクスポートしてDesire HDにこの.APKをインストールすると(アプリケーションの以前のインストールを最初に手動でアンインストールした場合)、クラッシュします。
私はカスタムは明らかに発見し、.classNotFoundException
につながることができない、レイアウトXMLファイルにその完全修飾名を使用して参照している、私のView
を拡張していることがわかりますLogcatのエラーを検査しました。 Logcatのエラートレースからの関心の
の2行は、次のとおりです。
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
そして以下にさらに:
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
このクラッシュアプリケーションをEclipseのからインストールされている場合は発生しません。エクスポートされた.APKからインストールされた場合のみです。
これがProguardの問題である場合は、ここにProguard構成ファイルがあります。私はProguardを初めて使うので、デフォルトから実際に触れていません。私のProguardのバージョンは4.7です。
-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 <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(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 *;
}
膨らんでいるXMLファイル。 (内の要素は、親FrameLayout
に子として追加されるためMerge
タグが使用されている。)この上の任意のヒントを事前に
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<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"/>
<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" />
<include
android:layout_gravity="top|left"
layout="@layout/status_bar"
android:id="@+id/statusBar" />
<TextView
android:layout_gravity="bottom|left"
android:id="@+id/pollRate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</TextView>
</merge>
感謝。他の抽出や設定情報が必要な場合は、叫んでください。
/tools/proguard/proguard-android.txtデフォルト1または$ {} sdk.dirで最適化された1によって、プロジェクト内の1を置き換えることができ引き起こしているxmlファイルを共有してくださいインフレ。 –
@Anurag Ramdasan - 良い点、ありがとうございます。 XMLレイアウトを追加しました。 – Trevor
アクティビティで 'DashboardLayout'オブジェクトにアクセスしようとしましたか?それを試して、それがクラスを削除しているものであるかどうか確認してください。実際には、DEXed jarを開いてクラスがあるかどうかを確認することもできます。そうでなければ、おそらくプロガードです。 – dmon