异常java.lang.NoClassDefFoundError:pim

时间:2018-02-07 22:25:55

标签: java android firebase android-recyclerview firebase-crash-reporting

我在崩溃报告中遇到了这个崩溃:

Exception java.lang.NoClassDefFoundError: pim
pil.<clinit> (SourceFile:2)
pij.onAnimationEnd (SourceFile:10)
android.animation.AnimatorSet$AnimatorSetListener.onAnimationEnd     (AnimatorSet.java:818)
android.animation.ValueAnimator.endAnimation (ValueAnimator.java:1056)
android.animation.ValueAnimator.access$400 (ValueAnimator.java:50)
android.animation.ValueAnimator$AnimationHandler.doAnimationFrame     (ValueAnimator.java:644)
android.animation.ValueAnimator$AnimationHandler.run (ValueAnimator.java:660)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:761)
android.view.Choreographer.doCallbacks (Choreographer.java:574)
android.view.Choreographer.doFrame (Choreographer.java:543)
android.view.Choreographer$FrameDisplayEventReceiver.run     (Choreographer.java:747)
android.os.Handler.handleCallback (Handler.java:733)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:136)
android.app.ActivityThread.main (ActivityThread.java:5154)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:515)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run     (ZygoteInit.java:732)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:566)
dalvik.system.NativeStart.main (NativeStart.java)

在我将recyclelView添加到我的布局和更多代码之后,它开始发生了,但我怀疑它:

com.testapp.MyRecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/recycleViewImages"

这是我的自定义Recyclerview,但即使使用常规的recyclerview(不是我的自定义),也会发生此错误

这是我的自定义视图的代码:

public class MyRecyclerView extends RecyclerView {
private FirebaseAnalytics mFirebaseAnalytics = null;

public MyRecyclerView(Context context) {
    super(context);
    if (mFirebaseAnalytics == null && context != null) {
        mFirebaseAnalytics = FirebaseAnalytics.getInstance(context);
    }
}

public MyRecyclerView(Context context, @Nullable AttributeSet attrs) {
    super(context, attrs);
    if (mFirebaseAnalytics == null && context != null) {
        mFirebaseAnalytics = FirebaseAnalytics.getInstance(context);
    }
}

public MyRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (mFirebaseAnalytics == null && context != null) {
        mFirebaseAnalytics = FirebaseAnalytics.getInstance(context);
    }
}


@Override
protected void onAnimationEnd() {
    try {
        super.onAnimationEnd();
    }
    catch (Exception e) {
        Log.d("erez", "animation onAnimationEnd");
        if (mFirebaseAnalytics != null && e != null && e.getMessage() != null) {
            Bundle bundleCatch = new Bundle();
            bundleCatch.putString(FirebaseAnalytics.Param.ITEM_ID, "myrecycleview e: " + e.getMessage());
            bundleCatch.putString(FirebaseAnalytics.Param.ITEM_NAME, "myrecycleview e: " + e.getMessage());
            bundleCatch.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "onAnimationEnd catched");

        mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundleCatch);
        }
    }
    catch (NoClassDefFoundError ncdfe) {
        if (mFirebaseAnalytics != null && ncdfe != null && ncdfe.getMessage() != null) {
            Bundle bundleCatch = new Bundle();
            bundleCatch.putString(FirebaseAnalytics.Param.ITEM_ID, "myrecycleview ncdfe: " + ncdfe.getMessage());
            bundleCatch.putString(FirebaseAnalytics.Param.ITEM_NAME, "myrecycleview ncdfe: " + ncdfe.getMessage());
            bundleCatch.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "onAnimationEnd catched");
          mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundleCatch);
        }
    }
}

}

如您所见,我试图覆盖 onAnimationEnd ,以便将捕获日志写入firebase,但它并未在那里捕获并且仍在为用户崩溃。

无论如何,这个MyRecyclerView作为我的Activity中的成员保存:

我通过findViewById设置它然后:

LinearLayoutManager layoutManager = new LinearLayoutManager(Player.this);
    if (mScreenOrientation == Configuration.ORIENTATION_PORTRAIT) {
        layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    } else if (mScreenOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    }
    mRecycleViewPreviewedVideos.setLayoutManager(layoutManager);

然后我在这里设置了适配器。没什么特别的。 我知道View有一个名为onAnimationEnd的方法,但它从未在我的智能手机中达到它。它主要是在Api 19上达成的。 (还有17和18)。

任何人都遇到过这次崩溃?如何解决?

更新

我在这里报告了错误:https://issuetracker.google.com/issues/73048586

1 个答案:

答案 0 :(得分:2)

所以我向谷歌报告了这个问题,现在他们回复说错误是修复的! :-)我想不需要更新库,因为没有可用的更新。此外,我还尝试使用YouTube的库,但同样崩溃,因此与库有关。 Google写道:“开发团队已经解决了您已报告的问题,并且将在未来版本中提供。”