alhappler/alh_pdf_view

Not working on release mode - playstore

Closed this issue · 9 comments

Not working on release mode - playstore

Hi @shubhamsinha2009
Thank you for opening this issue.
Could you provide more information about your problem?

You can paste the text of flutter doctor -v here.

And do you know which device had this problem and which Android version was used?

Hi @shubhamsinha2009 Thank you for opening this issue. Could you provide more information about your problem?

You can paste the text of flutter doctor -v here.

And do you know which device had this problem and which Android version was used?

Android 11 and 12

Also facing this issue. Project builds but AlhPdfView is not visible on the screen.

Really hoping you can fix this as this is possible the best pdf package out there at the moment.

Potential issue

I've found this in the onError:

java.lang.UnsatisfiedLinkError: No implementation found for long d.e.a.c.o(int, java.lang.String) (tried Java_d_e_a_c_o and Java_d_e_a_c_o__ILjava_lang_String_2)

Package

alh_pdf_view: ^0.3.0

Flutter doctor -v

[✓] Flutter (Channel stable, 3.0.3, on macOS 11.6 20G165 darwin-x64, locale en-GB)
    • Flutter version 3.0.3 at /Users/chris/Developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 676cefaaff (8 days ago), 2022-06-22 11:34:49 -0700
    • Engine revision ffe7b86a1e
    • Dart version 2.17.5
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/chris/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • ANDROID_SDK_ROOT = /Users/chris/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.68.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.42.0

[✓] Connected device (3 available)
    • Mi 9T Pro (mobile) • 94b9d1dc • android-arm64  • Android 11 (API 30)
    • macOS (desktop)    • macos    • darwin-x64     • macOS 11.6 20G165 darwin-x64
    • Chrome (web)       • chrome   • web-javascript • Google Chrome 103.0.5060.53

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

I have found a fix

Create a file called proguard-rules.pro in android/app/ directory.

Add this to the file

-keepclasseswithmembernames,includedescriptorclasses class * {
    native <methods>;
}

in the app level build.gradle (android/app/build.gradle) add this to your release build type

            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

e.g.

    buildTypes {
        release {
            signingConfig signingConfigs.debug
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

Hello @carman247
Thank you for the extra information.
I will try to reproduce this problem and will release a fix asap.

@andreBalh

No problem, unfortunately I'm not sure how to implement this fix in the package, only projects depending on it

Yep your suggested solution would work and I could implement this for the example project but it would be better if you don't have to add proguard just to fix it @carman247

I found a solution to fix this problem, I will make a PR and release the fix @carman247 @shubhamsinha2009

I am closing this issue, fix will be released in v.0.3.1