Search code examples
flutterepub

epub_viewer Package Release Build Crash


I am developing an app with epub_viewer package and i set the app in release mode. Android app crashing on start if i use epub_viewer package. I'm sure i did everything right. By the way it works in debug mode. I opened a github issue but I couldn't find anything, maybe i can find help here. I tried all packages in pub dev but none of them worked properly. I would be very grateful if you have a working package or a different method to suggest.

            EpubViewer.setConfig(
                themeColor: Theme.of(context).primaryColor,
                identifier: "iosBook",
                scrollDirection: EpubScrollDirection.ALLDIRECTIONS,
                allowSharing: true,
                enableTts: true,
                nightMode: false
                );

            EpubViewer.locatorStream.listen((locator) {
              debugPrint(
                  'LOCATOR: ${EpubLocator.fromJson(jsonDecode(locator))}');
            });

            EpubViewer.open(ePubUrl);

Solution

  • I've been dealing with this problem for a long time and finally i realized my packages were conflicting.

    epub_viewer and adapty_flutter package were not working at the same time in release mode. To solve this, just add the code below in your app level build.gradle

    The issue of my problem is attached.

    flutter {
        source '../..'
    }
    
    dependencies {
        implementation ..
    
        // Add this lines app level build.gradle
        implementation('androidx.appcompat:appcompat') {
        version {
            strictly '1.2.0'
            }
        }
        implementation 'androidx.core:core:1.5.0'
        // Your problem will be solved.
    }