Android应用在设备上工作但不在三星设备上工作

时间:2014-08-29 01:07:26

标签: android

我开发了一款Android应用程序,适用于索尼,谷歌Nexus,Oppo和少数设备,但不适用于三星设备。

每当我使用三星设备运行应用程序时,它会在某些功能下崩溃。

我为上面的设备尝试了不同的Android版本。但是,只有三星设备与该应用程序不兼容。

我做谷歌但没有找到答案。关于它的任何想法?

更新

这是功能中的一个不起作用:

public void onClickProduct(View view){
    ImageView ImageIcon = (ImageView)findViewById(R.id.product_Button);
    ImageIcon.setImageResource(R.drawable.products_b_reverse);  
    startActivity(new Intent(Home.this, ProductServiceIndicator.class));    
    overridePendingTransition(R.anim.flipcard_from_middle, R.anim.flipcard_to_middle);
    finish();       
}

以下是原木车

08-29 10:17:59.891: W/dalvikvm(9042): threadid=1: thread exiting with uncaught exception (group=0x417a0da0) 
08-29 10:17:59.901: E/AndroidRuntime(9042): FATAL EXCEPTION: main 
08-29 10:17:59.901: E/AndroidRuntime(9042): Process: com.toppan.toppan_android_v1, PID: 9042 
08-29 10:17:59.901: E/AndroidRuntime(9042): android.view.InflateException: Binary XML file line #35: Error inflating class 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.createView(LayoutInflater.java:626) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at com.toppan.toppan_android_v1.ViewPagerAdapter.instantiateItem(ViewPagerAdapter.java:33) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.support.v4.view.PagerAdapter.instantiateItem(PagerAdapter.java:110) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:837) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.support.v4.view.ViewPager.populate(ViewPager.java:1053) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.support.v4.view.ViewPager.populate(ViewPager.java:919) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.View.measure(View.java:17387) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.View.measure(View.java:17387) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5365) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.View.measure(View.java:17387) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5365) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.View.measure(View.java:17387) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5365) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2505) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.View.measure(View.java:17387) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2176) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1317) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1514) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1201) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6404) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.Choreographer.doCallbacks(Choreographer.java:603) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.Choreographer.doFrame(Choreographer.java:573) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.os.Handler.handleCallback(Handler.java:733) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.os.Handler.dispatchMessage(Handler.java:95) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.os.Looper.loop(Looper.java:157) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.app.ActivityThread.main(ActivityThread.java:5293) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at java.lang.reflect.Method.invokeNative(Native Method) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at java.lang.reflect.Method.invoke(Method.java:515) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at dalvik.system.NativeStart.main(Native Method) 
08-29 10:17:59.901: E/AndroidRuntime(9042): Caused by: java.lang.reflect.InvocationTargetException 
08-29 10:17:59.901: E/AndroidRuntime(9042): at java.lang.reflect.Constructor.constructNative(Native Method) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.createView(LayoutInflater.java:600) 
08-29 10:17:59.901: E/AndroidRuntime(9042): ... 47 more 
08-29 10:17:59.901: E/AndroidRuntime(9042): Caused by: java.lang.OutOfMemoryError 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:677) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:507) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:872) 
08-29 10:17:59.891: W/dalvikvm(9042): threadid=1: thread exiting with uncaught exception (group=0x417a0da0) 
08-29 10:17:59.901: E/AndroidRuntime(9042): FATAL EXCEPTION: main 
08-29 10:17:59.901: E/AndroidRuntime(9042): Process: com.toppan.toppan_android_v1, PID: 9042 
08-29 10:17:59.901: E/AndroidRuntime(9042): android.view.InflateException: Binary XML file line #35: Error inflating class 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.createView(LayoutInflater.java:626) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at com.toppan.toppan_android_v1.ViewPagerAdapter.instantiateItem(ViewPagerAdapter.java:33) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.support.v4.view.PagerAdapter.instantiateItem(PagerAdapter.java:110) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:837) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.support.v4.view.ViewPager.populate(ViewPager.java:1053) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.support.v4.view.ViewPager.populate(ViewPager.java:919) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.View.measure(View.java:17387) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.View.measure(View.java:17387) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5365) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.View.measure(View.java:17387) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5365) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.View.measure(View.java:17387) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5365) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2505) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.View.measure(View.java:17387) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2176) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1317) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1514) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1201) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6404) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.Choreographer.doCallbacks(Choreographer.java:603) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.Choreographer.doFrame(Choreographer.java:573) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.os.Handler.handleCallback(Handler.java:733) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.os.Handler.dispatchMessage(Handler.java:95) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.os.Looper.loop(Looper.java:157) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.app.ActivityThread.main(ActivityThread.java:5293) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at java.lang.reflect.Method.invokeNative(Native Method) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at java.lang.reflect.Method.invoke(Method.java:515) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at dalvik.system.NativeStart.main(Native Method) 
08-29 10:17:59.901: E/AndroidRuntime(9042): Caused by: java.lang.reflect.InvocationTargetException 
08-29 10:17:59.901: E/AndroidRuntime(9042): at java.lang.reflect.Constructor.constructNative(Native Method) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.view.LayoutInflater.createView(LayoutInflater.java:600) 
08-29 10:17:59.901: E/AndroidRuntime(9042): ... 47 more 
08-29 10:17:59.901: E/AndroidRuntime(9042): Caused by: java.lang.OutOfMemoryError 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:677) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:507) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:872) 
08-29 10:17:59.901: E/AndroidRuntime(9042): at android.content.res.Resources.loadDrawable(Resources.java:

这是XML

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.toppan.toppan_android_v1.Home" >

    <ImageView 
        android:id="@+id/top_pannel_bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="0dp"
        android:layout_marginLeft="0dp"
        android:scaleType="fitStart"
        android:contentDescription="@string/login_logo"
        android:src="@drawable/top01" />

    <ImageView 
        android:id="@+id/top_pannel_logo"
        android:layout_width="wrap_content"
        android:layout_height="20dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="15dp"
        android:layout_marginLeft="10dp"
        android:scaleType="fitStart"
        android:contentDescription="@string/login_logo"
        android:src="@drawable/logo_white" />

    <ImageButton
        android:id="@+id/viewPagerLogOutButton"
        android:layout_width="23dp"
        android:layout_height="20dp"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="15dp"
        android:layout_marginRight="10dp"
        android:background="@android:color/transparent"
        android:contentDescription="@string/clicktohome"
        android:onClick="onClickViewLogout"
        android:scaleType="fitEnd"
        android:gravity="right"
        android:src="@drawable/logout_gray_01" />

    <android.support.v4.view.ViewPager
        android:id="@+id/mypanelpager"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginTop="35dp" />

    <com.toppan.toppan_android_v1.TouchHighlightImageButton
        android:id="@+id/locate_button_viewpager"
        android:layout_width="73dp"
        android:layout_height="55dp"
        android:layout_alignParentBottom="true"
        android:scaleType="fitXY"
        android:gravity="bottom"
        android:onClick="locate_us_viewPager"
        android:contentDescription="@string/locate_gray" 
        android:src="@drawable/locate01" />

    <com.toppan.toppan_android_v1.TouchHighlightImageButton
        android:id="@+id/message_button_viewpager"
        android:layout_width="72dp"
        android:layout_height="55dp"
        android:layout_alignParentBottom="true"
        android:scaleType="fitXY"
        android:gravity="bottom"
        android:layout_alignRight="@+id/locate_button_viewpager"
        android:layout_alignTop="@+id/locate_button_viewpager"
        android:layout_marginRight="-72dp"
        android:contentDescription="@string/messages_gray" 
        android:src="@drawable/messages01" />

    <com.toppan.toppan_android_v1.TouchHighlightImageButton
        android:id="@+id/home_button_viewpager"
        android:layout_width="72dp"
        android:layout_height="55dp"
        android:layout_alignParentBottom="true"
        android:scaleType="fitXY"
        android:gravity="bottom"
        android:layout_alignRight="@+id/message_button_viewpager"
        android:layout_alignTop="@+id/message_button_viewpager"
        android:layout_marginRight="-72dp"
        android:onClick="home_viewPager_onclick"
        android:contentDescription="@string/home_gray" 
        android:src="@drawable/home01" />

    <com.toppan.toppan_android_v1.TouchHighlightImageButton
        android:id="@+id/contact_button_viewpager"
        android:layout_width="73dp"
        android:layout_height="55dp"
        android:layout_alignParentBottom="true"
        android:scaleType="fitXY"
        android:gravity="bottom"
        android:layout_alignRight="@+id/home_button_viewpager"
        android:layout_alignTop="@+id/home_button_viewpager"
        android:layout_marginRight="-72dp"
        android:onClick="contact_us_viewPager"
        android:contentDescription="@string/contactus" 
        android:src="@drawable/contacts01" />

    <com.toppan.toppan_android_v1.TouchHighlightImageButton
        android:id="@+id/more_button_viewpager"
        android:layout_width="73dp"
        android:layout_height="55dp"
        android:layout_alignParentBottom="true"
        android:scaleType="fitXY"
        android:gravity="bottom"
        android:layout_alignRight="@+id/contact_button_viewpager"
        android:layout_alignTop="@+id/contact_button_viewpager"
        android:layout_marginRight="-73dp"
        android:onClick="moreOnClickViewPager"
        android:contentDescription="@string/moregray" 
        android:src="@drawable/more01" />

    <com.viewpagerindicator.CirclePageIndicator
        android:id="@+id/indicator"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/locate_button_viewpager"
        android:layout_alignParentLeft="true"
        android:padding="10dip" 
        app:fillColor="#77D9D3"
        app:pageColor="#ffffff"
        />


</RelativeLayout>

1 个答案:

答案 0 :(得分:1)

您的代码触发了内存不足错误,可能是因为加载了太大的图形资源。它位于靠近底部的堆栈跟踪中,提到的另一个错误是由内存不足造成的。

内存不足错误可能很难跟踪,因为事件序列是

  1. 您的代码占用大部分内存且分配量大
  2. 稍后会再次尝试分配内存(可能在某些系统库中)
  3. 您获得的堆栈跟踪并不指向导致问题的行,而是指向系统库。
  4. 因此,您必须查看大型图形资源(可能是代码块中可绘制的位图)以找出要修复的内容。

    现在它在某些手机上工作的事实是红鲱鱼。任何设备都可能发生此崩溃。