簡體   English   中英

Android 應用程序在三星設備上因 SIGABRT 錯誤而崩潰

[英]Android app crashes with a SIGABRT error on Samsung device

我正在運行 FirebaseRecyclerAdapter 並在 onBindViewHolder 方法中將用戶的個人資料圖片加載到 Picasso 中。 當我在運行 Android 6.0 的 Le Eco 2 設備上運行該應用程序時,它運行得非常好。

但是,當我在 Samsung J7 Prime 2 上運行我的應用程序時,它在 logcat 中給了我以下錯誤:

07-24 19:44:29.841 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: MSG_WINDOW_FOCUS_CHANGED 0
07-24 19:44:29.844 20565-20587/com.myapp.www V/FA: Recording user engagement, ms: 34127
07-24 19:44:29.846 20565-20587/com.myapp.www V/FA: Connecting to remote service
07-24 19:44:29.848 20565-20587/com.myapp.www V/FA: Activity paused, time: 985889282
07-24 19:44:29.854 20565-20587/com.myapp.www D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=34127, firebase_screen_class(_sc)=DisplayPostsActivity, firebase_screen_id(_si)=-1674957241664244677}]
07-24 19:44:29.881 20565-20587/com.myapp.www V/FA: Connection attempt already in progress
07-24 19:44:29.881 20565-20587/com.myapp.www D/FA: Connected to remote service
07-24 19:44:29.882 20565-20587/com.myapp.www V/FA: Processing queued up service tasks: 2
07-24 19:44:29.953 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: mHardwareRenderer.destroy()#1
07-24 19:44:29.962 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: Relayout returned: oldFrame=[0,0][1080,1920] newFrame=[0,0][1080,1920] result=0x5 surface={isValid=false 0} surfaceGenerationChanged=true
07-24 19:44:30.027 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: mHardwareRenderer.destroy()#1
07-24 19:44:30.038 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: Relayout returned: oldFrame=[0,0][1080,1920] newFrame=[0,0][1080,1920] result=0x1 surface={isValid=false 0} surfaceGenerationChanged=false
07-24 19:44:30.039 20565-20565/com.myapp.www D/InputTransport: Input channel destroyed: fd=81
07-24 19:44:34.895 20565-20587/com.myapp.www V/FA: Inactivity, disconnecting from the service
07-24 19:46:37.623 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: mHardwareRenderer.destroy()#1
07-24 19:46:37.626 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: Relayout returned: oldFrame=[0,0][1080,1920] newFrame=[0,0][1080,1920] result=0x1 surface={isValid=false 0} surfaceGenerationChanged=false
07-24 19:46:37.649 20565-23426/com.myapp.www V/FA: Connecting to remote service
07-24 19:46:37.655 20565-23425/com.myapp.www I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
07-24 19:46:37.655 20565-23425/com.myapp.www I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
07-24 19:46:37.659 20565-23426/com.myapp.www V/FA: Activity resumed, time: 986017088
07-24 19:46:37.659 20565-20565/com.myapp.www V/Surface: sf_framedrop debug : 0x4f4c, game : false, logging : 0
07-24 19:46:37.659 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: Relayout returned: oldFrame=[0,0][1080,1920] newFrame=[0,0][1080,1920] result=0x3 surface={isValid=true -969377792} surfaceGenerationChanged=true
07-24 19:46:37.660 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: mHardwareRenderer.initialize() mSurface={isValid=true -969377792} hwInitialized=true
07-24 19:46:37.666 20565-20594/com.myapp.www D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000,  [1080x1920]-format:1
07-24 19:46:37.680 20565-20565/com.myapp.www W/Activity: AppLock checkAppLockState locked:false verifying:false pkgName = com.myapp.www isInMultiWindowMode:false showWhenLocked:false
07-24 19:46:37.704 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: MSG_WINDOW_FOCUS_CHANGED 1
07-24 19:46:37.704 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true -969377792}
07-24 19:46:37.706 20565-20565/com.myapp.www V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@c51d7a9 nm : com.myapp.www ic=null
07-24 19:46:37.706 20565-20565/com.myapp.www I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
07-24 19:46:37.708 20565-20565/com.myapp.www D/InputTransport: Input channel constructed: fd=82
07-24 19:46:37.711 20565-23426/com.myapp.www D/FA: Connected to remote service
07-24 19:46:37.712 20565-23426/com.myapp.www V/FA: Processing queued up service tasks: 1
07-24 19:46:39.503 20565-20570/com.myapp.www I/art: Do partial code cache collection, code=43KB, data=59KB
07-24 19:46:39.503 20565-20570/com.myapp.www I/art: After code cache collection, code=42KB, data=58KB
07-24 19:46:39.503 20565-20570/com.myapp.www I/art: Increasing code cache capacity to 256KB
07-24 19:46:42.396 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: ViewPostImeInputStage processPointer 0
07-24 19:46:42.482 20565-20565/com.myapp.www D/ViewRootImpl@12b4d4f[DisplayPostsActivity]: ViewPostImeInputStage processPointer 1
07-24 19:46:42.520 20565-20565/com.myapp.www D/ScrollView: initGoToTop
07-24 19:46:42.639 20565-20565/com.myapp.www D/ScrollView:  onsize change changed 
07-24 19:46:42.641 20565-20565/com.myapp.www D/ScrollView: initGoToTop
07-24 19:46:42.738 20565-20565/com.myapp.www D/ScrollView:  onsize change changed 
07-24 19:46:42.773 20565-20572/com.myapp.www W/art: Suspending all threads took: 29.264ms
07-24 19:46:42.795 20565-20594/com.myapp.www W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3438x8658, max=8192x8192)
07-24 19:46:42.813 20565-20594/com.myapp.www W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3438x8658, max=8192x8192)
07-24 19:46:42.814 20565-23426/com.myapp.www V/FA: Inactivity, disconnecting from the service
07-24 19:46:42.817 20565-20565/com.myapp.www D/ScrollView: initGoToTop
07-24 19:46:42.867 20565-20594/com.myapp.www W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3438x8658, max=8192x8192)
07-24 19:46:42.868 20565-20594/com.myapp.www W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3438x8658, max=8192x8192)
07-24 19:46:42.868 20565-20594/com.myapp.www W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (3438x8658, max=8192x8192)
07-24 19:46:42.868 20565-20594/com.myapp.www A/OpenGLRenderer: failed storing bitmap shader data
07-24 19:46:42.869 20565-20594/com.myapp.www A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 20594 (RenderThread)

                                                        [ 07-24 19:46:42.870  2316: 2316 W/         ]
                                                        debuggerd: handling request: pid=20565 uid=10192 gid=10192 tid=20594

我正在使用 Picasso 從引用 Firebase Storage 提供的 URL 加載圖像。 這種方法在 Le Eco 設備上對我來說效果很好。

我嘗試根據這里的一些答案在 AndroidManifest.xml 中設置android:hardwareAccelerated=falseandroid:largeHeap=true 它有效,但它使應用程序非常緊張,這違背了擁有流暢應用程序的目的。 另外,如果它在我的其他設備上運行,那么問題應該是別的,對吧?

Firebase 中存儲的圖像在上傳前重新縮放為 300x300 並壓縮,並且大小小於 10kb ,因此“位圖太大而無法上傳”錯誤完全沒有意義。

編輯:這是在 RecyclerView 中使用的 cardview 的 XML 布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:cardview="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="48dp"
            cardview:cardCornerRadius="4dp"
            cardview:cardElevation="4dp">

            <include layout="@layout/post_shimmer"/>
            <include layout="@layout/image_shimmer"/>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <de.hdodenhof.circleimageview.CircleImageView
                        android:id="@+id/user_image_recycle"
                        android:layout_width="60dp"
                        android:layout_height="60dp"
                        android:layout_marginStart="16dp"
                        android:layout_marginTop="16dp"
                        android:clickable="true"
                        />

                    <TextView
                        android:id="@+id/post_type_recycle"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="16dp"
                        android:layout_marginTop="16dp"
                        android:layout_toRightOf="@+id/user_image_recycle"
                        android:textStyle="italic" />

                    <TextView
                        android:id="@+id/post_title_recycle"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/post_type_recycle"
                        android:layout_marginStart="16dp"
                        android:layout_toRightOf="@+id/user_image_recycle"
                        android:maxLines="1"
                        android:textColor="@android:color/black"
                        android:textSize="18sp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/user_name_recycle"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/post_title_recycle"
                        android:layout_marginStart="16dp"
                        android:layout_toRightOf="@+id/user_image_recycle"
                        android:textColor="#0094BD"
                        android:clickable="true"
                        android:textSize="16sp" />

                    <ImageView
                        android:id="@+id/post_divider"
                        android:layout_width="match_parent"
                        android:layout_height="2dp"
                        android:layout_below="@+id/user_image_recycle"
                        android:layout_marginEnd="16dp"
                        android:layout_marginStart="16dp"
                        android:layout_marginTop="16dp"
                        android:background="@android:color/black" />

                    <!-- It is CRUCIAL to keep the layout width to wrap_content otherwise
                    the text will not be selectable after Suggest change has been clicked
                    on once. This is an Android bug.
                    -->
                    <TextView
                        android:id="@+id/post_text_recycle"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/post_divider"
                        android:layout_marginEnd="16dp"
                        android:layout_marginStart="16dp"
                        android:layout_marginTop="16dp"
                        android:autoLink="web"
                        android:fontFamily="serif"
                        android:textColor="@android:color/black"
                        android:textColorHighlight="@android:color/holo_blue_light"
                        android:textIsSelectable="true"
                        android:textSize="16sp" />

                </RelativeLayout>
        </android.support.v7.widget.CardView>
    </ScrollView>
</RelativeLayout>

這是 onBindViewHolder 方法中的代碼,我使用 Picasso 來設置 ImageView:

final StorageReference imageRef = storageReference.child("images/" + uid).child("profile");
                        imageRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
                            @Override
                            public void onSuccess(Uri uri) {
                                Picasso.get().load(uri)
                                        .noFade()
                                        .into(holder.profile, new Callback() {
                                            @Override
                                            public void onSuccess() {

                                            }

                                            @Override
                                            public void onError(Exception e) {

                                                holder.profile.setImageDrawable(getResources().getDrawable(R.drawable.profile, null));
                                            }
                                        });
                            }
                        }).addOnFailureListener(new OnFailureListener() {
                            @Override
                            public void onFailure(@NonNull Exception e) {
                                holder.profile.setImageDrawable(getResources().getDrawable(R.drawable.profile, null));
                            }
                        });

編輯 2 :我從應用程序中刪除了所有畢加索參考資料。 它仍在崩潰。 我實際上沒有在應用程序的其他任何地方加載任何位圖。 這怎么可能?

我已經嘗試解決這個問題四個小時了,但似乎找不到任何合適的解決方案。

謝謝你的幫助!

hardwareaccelerated=false解決方案總是有效,但是,它大大降低了我的應用程序的速度。 我設法從這個文檔中找到了一個本地修復:

硬件加速

基本上,我只為 ViewHolder 中的 CircleImageView設置了硬件加速。 這是代碼:

private PostViewHolder(View itemView) {
            super(itemView);

            profile = (CircleImageView) itemView.findViewById(R.id.user_image_recycle);
            profile.setLayerType(View.LAYER_TYPE_SOFTWARE,null);
}

profile.setLayerType(View.LAYER_TYPE_SOFTWARE,null)允許為圖像關閉硬件加速。 此后其他一切正常。 視圖仍然有點緊張,但不是很明顯。 圖像加載! 好極了!

查看錯誤 - too large to be uploaded into a texture我建議您在上傳或下載時調整圖像大小

畢加索.get()什么? Picasso.get()您沒有在此處傳遞任何活動或上下文

另外, .into(holder.profile)應該是你的 imageview 我建議你試試下面的代碼

位圖 yourBitmap; 位圖調整大小 = Bitmap.createScaledBitmap(yourBitmap, newWidth, newHeight, true);

Picasso.with(your_context_here)
                .load(resized)
                 .noFade()
                .centerCrop().fit()
                .into(imageView, new Callback() {
                    @Override
                    public void onSuccess() {
                     }

                    @Override
                    public void onError() {
                    }
                });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM