adaptyteam / AdaptySDK-Flutter

SDK for growing mobile in-app purchases
https://docs.adapty.io/docs/quickstart
MIT License
95 stars 17 forks source link

Adapty_flutter and epub_viewer can't work together #50

Closed Tahaylmz closed 2 years ago

Tahaylmz commented 2 years ago

Hi,

I was getting an error for a while in my app. At the end, I was trying to understand the cause of the error by removing the packages I used one by one. I finally found the reason for the crash. After removing the adapty_flutter package, I realized that there is no problem. There is obviously a conflict in the adapty_flutter package and the epub_viewer package. I'm open to any helpful information.

The error message i got: E/AndroidRuntime( 1638): java.lang.NoSuchFieldError: No static field abc_text_select_handle_middle_mtrl_dark of type I in class Lcom/folioreader/R$drawable; or its superclasses (declaration of 'com.folioreader.R$drawable' appears in /data/app/~~wsrkl0h87yoxUbPWj-P6Wg==/com.example.upubselfdemo-Tvu7HpZFMAKRbrLx2LFhLA==/base.apk!classes2.dex) E/AndroidRuntime( 1638): at com.folioreader.ui.view.FolioWebView.initViewTextSelection(FolioWebView.kt:287) E/AndroidRuntime( 1638): at com.folioreader.ui.view.FolioWebView.init(FolioWebView.kt:279) E/AndroidRuntime( 1638): at com.folioreader.ui.view.FolioWebView.setFolioActivityCallback(FolioWebView.kt:411) E/AndroidRuntime( 1638): at com.folioreader.ui.fragment.FolioPageFragment.initWebView(FolioPageFragment.kt:375) E/AndroidRuntime( 1638): at com.folioreader.ui.fragment.FolioPageFragment.onCreateView(FolioPageFragment.kt:183) E/AndroidRuntime( 1638): at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2963) E/AndroidRuntime( 1638): at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:518) E/AndroidRuntime( 1638): at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282) E/AndroidRuntime( 1638): at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189) E/AndroidRuntime( 1638): at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100) E/AndroidRuntime( 1638): at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1971) E/AndroidRuntime( 1638): at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:311) E/AndroidRuntime( 1638): at androidx.fragment.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:274) E/AndroidRuntime( 1638): at com.folioreader.ui.view.DirectionalViewpager.populate(DirectionalViewpager.java:1327) E/AndroidRuntime( 1638): at com.folioreader.ui.view.DirectionalViewpager.populate(DirectionalViewpager.java:1105) E/AndroidRuntime( 1638): at com.folioreader.ui.view.DirectionalViewpager.onMeasure(DirectionalViewpager.java:1828) E/AndroidRuntime( 1638): at android.view.View.measure(View.java:25466) E/AndroidRuntime( 1638): at androidx.constraintlayout.widget.ConstraintLayout.onMeasure(ConstraintLayout.java:1676) E/AndroidRuntime( 1638): at android.view.View.measure(View.java:25466) E/AndroidRuntime( 1638): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957) E/AndroidRuntime( 1638): at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) E/AndroidRuntime( 1638): at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145) E/AndroidRuntime( 1638): at android.view.View.measure(View.java:25466) E/AndroidRuntime( 1638): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957) E/AndroidRuntime( 1638): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) E/AndroidRuntime( 1638): at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) E/AndroidRuntime( 1638): at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) E/AndroidRuntime( 1638): at android.view.View.measure(View.java:25466) E/AndroidRuntime( 1638): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957)

vladd-g commented 2 years ago

Hi @Tahaylmz

I think this is the solution. You can put the images in your res/drawable folders in Android Studio (don't forget to choose the correct modifier when pasting - -mdpi, -hdpi, etc. - and the name "abc_text_select_handle_middle_mtrl_dark" so that they override those absent resources)

Or maybe some other suggestions from the comments will help

vladd-g commented 2 years ago

@Tahaylmz alternatively you can try to do the following.

Please find your build.gradle file corresponding to this (your app's build.gradle file on the main module level), and below the anchored line add this code:

implementation('androidx.appcompat:appcompat') {
    version {
        strictly '1.2.0'
    }
}
implementation 'androidx.core:core:1.5.0'

But if you do, please don't forget to test that nothing else breaks

Tahaylmz commented 2 years ago

Second method solved my problem thank you so much :) Have a good day.