mancj / SlideUp-Android

SlideUp is a small library that allows you to add sweet slide effect to any view.
MIT License
1.64k stars 207 forks source link

library source code does not match the bytecode for class SlideUp #22

Closed meroshan closed 7 years ago

meroshan commented 7 years ago

Hi, I followed the steps given in readme, but every time I am getting this error -

java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.view.View.getResources()' on a null object reference at com.mancj.slideup.SlideUp$Builder.(SlideUp.java:165)

This is my code - slideView = (LinearLayout) findViewById(R.id.slideView); slideUp = new SlideUp.Builder(slideView) .withStartState(SlideUp.State.HIDDEN) .withStartGravity(Gravity.BOTTOM) .build(); slideUp.show();

xml file - <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/slideView" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">

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

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/sliderview" />
</LinearLayout>

And when I opened the SlideUp.class file, I got this error - library source code does not match the bytecode for class SlideUp

Please help me, I have been scratching my head for 3hrs.

Thanks

mancj commented 7 years ago

Hi!

And when I opened the SlideUp.class file, I got this error - library source code does not match the bytecode for class SlideUp

I have never encountered such a problem. Disable Instant Run and try build clean

java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.view.View.getResources()' on a null object reference at com.mancj.slideup.SlideUp$Builder.(SlideUp.java:165)

SlideUp trying to get resources of your view here, but it looks like it is null. Check whether the slideView is null.

meroshan commented 7 years ago

Thanks for answering. Actually I was calling sliderView before setContentView that's why it was always null, silly mistake.