2011-09-21 76 views
2

我正在使用三星Galaxy S 4G(新的)。之前,我在戴爾Streak平板電腦以及HTC Desire上測試了它,並且它表現完美。我的應用程序的文本和大小變得越來越小,直到它最終崩潰。爲什麼?

但是現在,當我啓動應用程序時,事情並沒有對齊,並且隨着應用程序的使用,文本變得越來越小,圖形變得歪斜,直到最終應用程序崩潰。

這是爲什麼?我該如何解決它?

我不會改變任何東西的大小......就像我說過的,我在其他兩個設備上使用了相同的應用程序,沒有任何改變。我目前認爲它可能與Manifest文件,SDK版本問題有關?我讀了一個類似的問題,當有人改變語言,文字變小,這是固定與

<uses-sdk android:minSdkVersion="integer"> 

所以我正在調查。

編輯:logcat的輸出:

09-21 15:18:34.301: ERROR/AndroidRuntime(7377): FATAL EXCEPTION: main 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377): java.lang.RuntimeException: Unable to   start activity ComponentInfo{a.company.organization/a.company.organization.travel.TravelTab}:  java.lang.RuntimeException: Unable to start activity ComponentInfo{a.company.organization/a.company.organization.travel.TravelMap}: android.view.InflateException: Binary XML file line #130: Error inflating class <unknown> 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.app.ActivityThread.access$2300(ActivityThread.java:125) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.os.Handler.dispatchMessage(Handler.java:99) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.os.Looper.loop(Looper.java:123) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.app.ActivityThread.main(ActivityThread.java:4627) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at java.lang.reflect.Method.invokeNative(Native Method) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at java.lang.reflect.Method.invoke(Method.java:521) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at dalvik.system.NativeStart.main(Native Method) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{a.company.organization/a.company.organization.travel.TravelMap}: android.view.InflateException: Binary XML file line #130: Error inflating class <unknown>09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.app.ActivityThread.startActivityNow(ActivityThread.java:2503) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at a.company.organization.tabcontrol.TabBarActivity.displayCurrentScreen(TabBarActivity.java:159) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at a.company.organization.tabcontrol.TabBarActivity.displayCurrentScreen(TabBarActivity.java:137) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at a.company.organization.tabcontrol.TabBarActivity.setCurrentTab(TabBarActivity.java:422) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at a.company.organization.tabcontrol.TabBarActivity.onCreate(TabBarActivity.java:369) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  ... 11 more 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377): Caused by: android.view.InflateException: Binary XML file line #130: Error inflating class <unknown> 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.view.LayoutInflater.createView(LayoutInflater.java:513) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:618) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:621) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:621) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:621) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at a.company.organization.travel.TravelMap.onCreate(TravelMap.java:66) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  ... 20 more 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377): Caused by: java.lang.reflect.InvocationTargetException 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.widget.ImageView.<init>(ImageView.java:108) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at java.lang.reflect.Constructor.constructNative(Native Method) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at java.lang.reflect.Constructor.newInstance(Constructor.java:446) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.view.LayoutInflater.createView(LayoutInflater.java:500) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  ... 32 more 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-mdpi/carousel_top_bar.png from drawable resource ID #0x7f020087 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.content.res.Resources.loadDrawable(Resources.java:1714) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.widget.ImageView.<init>(ImageView.java:118) 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  ... 36 more 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377): Caused by: java.lang.IllegalArgumentException: width and height must be > 0 
09-21 15:18:34.301: ERROR/AndroidRuntime(7377):  at android.graphics.Bitmap.nativeCreate(Nati 
09-21 15:18:34.313: WARN/ActivityManager(6572): Force finishing activity a.company.organization/.travel.TravelTab 
09-21 15:18:34.316: ERROR/(6572): Dumpstate > /data/log/dumpstate_app_error 
+0

我們需要查看一些代碼才能診斷問題。請用簡短的代碼段編輯您的問題。 – brc

+0

添加一些代碼。並且放置一些logcat調試輸出。 –

+4

您是否偶然在項目的任何地方使用了DrinkMeShrinkMe對象? –

回答

2

要解決這個問題,你應該限制SDK版本。要做到這一點爲2.0及以上加:

<uses-sdk android:minSdkVersion="5" android:maxSdkVersion="5" /> 

你也應該修改清單文件包括:

<supports-screens android:smallScreens="true" 
android:largeScreens="true" android:resizeable="false" 
android:normalScreens="true" android:anyDensity="true"></supports-screens> 

我用來找出的是here的資源,併爲API級別到平臺等級檢查我使用this

+0

解決了問題!謝謝。 – digerati32

相關問題