AppIntro / AppIntro

Make a cool intro for your Android app.
Apache License 2.0
10.52k stars 1.77k forks source link

java.lang.NoSuchMethodErro setBreakStrategy on android 4.3 #909

Closed ahmednezhi closed 3 years ago

ahmednezhi commented 3 years ago

AppIntro Version: 6.0.0

Device/Android Version: Galaxy s3, Android 4.3

Issue details / Repro steps / Use case background: Application crash in when i launch on android 4.3 devices, it works fine on other versions: image image

Your Code:

import androidx.fragment.app.Fragment;

import android.content.Intent;
import android.os.Bundle;

import com.github.appintro.AppIntro2;
import com.softcore.rogara.fragment.FirstScreenSlidePage;
import com.softcore.rogara.fragment.SecondScreenSlidePage;

public class ScreenSlidePager extends AppIntro2 {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setImmersiveMode();
        isIndicatorEnabled();
        // Switch from Dotted Indicator to Progress Indicator
        setProgressIndicator();
        isColorTransitionsEnabled();
        addSlide(FirstScreenSlidePage.newInstance());
        addSlide(SecondScreenSlidePage.newInstance());
    }

    @Override
    protected void onSkipPressed(Fragment currentFragment) {
        super.onSkipPressed(currentFragment);
        goToHome();
    }

    @Override
    protected void onDonePressed(Fragment currentFragment) {
        super.onDonePressed(currentFragment);
        goToHome();
    }

    private void goToHome() {
        startActivity(new Intent(this, MainActivity.class));
    }
}

Stack trace / LogCat:

Fatal Exception: java.lang.NoSuchMethodError: android.widget.TextView.setBreakStrategy
       at com.softcore.rogara.fragment.FirstScreenSlidePage.onCreateView(FirstScreenSlidePage.java)
       at androidx.fragment.app.FragmentViewLifecycleOwner.initialize(FragmentViewLifecycleOwner.java)
       at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:12)
       at androidx.fragment.app.FragmentManagerImpl.findFragmentUnder(FragmentManagerImpl.java)
       at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:4)
       at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:7)
       at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java)
       at androidx.fragment.app.FragmentManagerImpl.execSingleAction(FragmentManagerImpl.java:3)
       at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:3)
       at androidx.fragment.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:3)
       at androidx.viewpager.widget.ViewPager.populate(ViewPager.java)
       at androidx.viewpager.widget.ViewPager.populate(ViewPager.java)
       at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java)
       at android.view.View.measure(View.java:16831)
       at androidx.constraintlayout.widget.ConstraintLayout$Measurer.measure(ConstraintLayout.java:23)
       at androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer.measure(ConstraintWidgetContainer.java:4)
       at androidx.constraintlayout.solver.widgets.ConstraintAnchor.getDependents(ConstraintAnchor.java)
       at androidx.constraintlayout.solver.widgets.analyzer.Direct.solveVerticalMatchConstraint(Direct.java:6)
       at androidx.constraintlayout.solver.widgets.analyzer.Direct.verticalSolvingPass(Direct.java:13)
       at androidx.constraintlayout.solver.widgets.analyzer.Direct.solvingPass(Direct.java:36)
       at androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer.layout(ConstraintWidgetContainer.java:36)
       at androidx.constraintlayout.solver.widgets.analyzer.BasicMeasure.solveLinearSystem(BasicMeasure.java:6)
       at androidx.constraintlayout.solver.widgets.analyzer.BasicMeasure.solverMeasure(BasicMeasure.java:63)
       at androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer.measure(ConstraintWidgetContainer.java:63)
       at androidx.constraintlayout.widget.ConstraintLayout.resolveSystem(ConstraintLayout.java:63)
       at androidx.constraintlayout.widget.ConstraintLayout.onMeasure(ConstraintLayout.java:63)
       at android.view.View.measure(View.java:16831)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
       at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java)
       at android.view.View.measure(View.java:16831)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
       at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:8)
       at android.view.View.measure(View.java:16831)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
       at android.view.View.measure(View.java:16831)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
       at android.view.View.measure(View.java:16831)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5245)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
       at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2586)
       at android.view.View.measure(View.java:16831)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2189)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1352)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1535)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1249)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6364)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
       at android.view.Choreographer.doCallbacks(Choreographer.java:591)
       at android.view.Choreographer.doFrame(Choreographer.java:561)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
       at android.os.Handler.handleCallback(Handler.java:730)
       at android.os.Handler.dispatchMessage(Handler.java:92)
       at android.os.Looper.loop(Looper.java:176)
       at android.app.ActivityThread.main(ActivityThread.java:5419)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:525)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
       at dalvik.system.NativeStart.main(NativeStart.java)
ahmednezhi commented 3 years ago

Sorry, after investigation it appeared that the problem wasn't in Appintro lib. I used TextView.setBreakStrategy() on devices below API (M).