AgoraIO-Community / Agora-Flutter-Quickstart

Quickstart guide for the Agora Flutter SDK(Android/iOS)
MIT License
507 stars 193 forks source link

App Crash in Release Mode #48

Closed HardikkMadaan closed 4 years ago

HardikkMadaan commented 4 years ago

The app crashes as soon as i try to enter a channel name and click on join in release mode . I have added the keep class statement to my proguard file and also removed 'arm-v8a- from the ndk in build.gradle.

This is my log. Please help! ''' E/flutter ( 5813): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.NoSuchMethodError: no static or non-static method "Lio/agora/rtc/internal/RtcEngineImpl;.nativeGetParameters(JLjava/lang/String;)Ljava/lang/String;" E/flutter ( 5813): at java.lang.Runtime.nativeLoad(Native Method) E/flutter ( 5813): at java.lang.Runtime.doLoad(Runtime.java:435) E/flutter ( 5813): at java.lang.Runtime.loadLibrary(Runtime.java:370) E/flutter ( 5813): at java.lang.System.loadLibrary(System.java:1076) E/flutter ( 5813): at io.agora.rtc.internal.RtcEngineImpl.E(Unknown Source) E/flutter ( 5813): at io.agora.rtc.internal.RtcEngineImpl.F(Unknown Source) E/flutter ( 5813): at io.agora.rtc.c.a(Unknown Source) E/flutter ( 5813): at io.agora.a.c.onMethodCall(Unknown Source) E/flutter ( 5813): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(Unknown Source) E/flutter ( 5813): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(Unknown Source) E/flutter ( 5813): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(Unknown Source) E/flutter ( 5813): at android.os.MessageQueue.nativePollOnce(Native Method) E/flutter ( 5813): at android.os.MessageQueue.next(MessageQueue.java:323) E/flutter ( 5813): at android.os.Looper.loop(Looper.java:135) E/flutter ( 5813): at android.app.ActivityThread.main(ActivityThread.java:5539) E/flutter ( 5813): at java.lang.reflect.Method.invoke(Native Method) E/flutter ( 5813): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) E/flutter ( 5813): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) E/flutter ( 5813): F/flutter ( 5813): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env).

'''

plutoless commented 4 years ago

https://github.com/AgoraIO/Flutter-SDK/issues/32 please double check if this is relevant

HardikkMadaan commented 4 years ago

AgoraIO/Flutter-SDK#32 please double check if this is relevant

I followed this now the app is not crashing on release mode . But when i try to update it on play store, i receive the following error This release is not compliant with the Google Play 64-bit requirement

The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code: 9.

Include 64-bit and 32-bit native code in your app. Use the Android App Bundle publishing format to automatically ensure that each device architecture receives only the native code it needs. This avoids increasing the overall size of your app

And when i remove Agora from my project .This error also goes and i am able to publish the app on the Play Store

plutoless commented 4 years ago

i will double check this issue tomorrow

HardikkMadaan commented 4 years ago

i will double check this issue tomorrow

Did you check it sir?

plutoless commented 4 years ago

could you pls try following this thread to see if it fix your issue?

HardikkMadaan commented 4 years ago

could you pls try following this thread to see if it fix your issue?

I Tried them all, listed in this thread, the problem still persists!

LichKing-2234 commented 4 years ago

hey, check android.enableR8=true in your gradle.properties set this to your android/app/build.gradle, and try again

buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled false
            shrinkResources false
        }
}
HardikkMadaan commented 4 years ago

hey, check android.enableR8=true in your gradle.properties set this to your android/app/build.gradle, and try again

buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled false
            shrinkResources false
        }
}

I have done both of these, also there are many solutions in that thread. Can you please tell me one universal solution because I've tried different versions of those and they are not working. Thank you

LichKing-2234 commented 4 years ago

it just a minify problem, android.enableR8=true will enable minify, you have tried to add my configuration?

LichKing-2234 commented 4 years ago

you can give me your demo, I will try to help you

HardikkMadaan commented 4 years ago

you can give me your demo, I will try to help you

Sir my demo is a really normal application that was working fine on the play store also but not working when using this package. Please help

LichKing-2234 commented 4 years ago

can you modify our demo to repeat the bug?

HardikkMadaan commented 4 years ago

can you modify our demo to repeat the bug?

To repeat the bug, just upload your demo on the play store. The app downloads properly but does not get open

LichKing-2234 commented 4 years ago

before upload, the apk will crash by install with adb?

ahmadf20 commented 4 years ago

I'm having the same issue. Is there any solution yet?

matgeroe commented 4 years ago

disabling minifyEnabled and shrinkResources worked for me

LichKing-2234 commented 4 years ago

please refer to the readme.md

HardikkMadaan commented 4 years ago

The issue has been resolved for me. Thanks !

AnupKumarPanwar commented 4 years ago

@HardikkMadaan How did you solve this issue? The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code.

alidemircans commented 4 years ago

I integrated it into my project. I tested it in debug mode it worked. But when you publish it on google play, the application closes.

LichKing-2234 commented 4 years ago

@alidemircans what version have you used?

jaafarnejm commented 3 years ago

I faced the same problem with Flutter + Agora, I followed these steps which solved my problem:

  1. Add to android/app/build.gradle file inside buildTypes bloc:

    buildTypes {
        release {
            signingConfig signingConfigs.release
    
            minifyEnabled true // Add this
            useProguard true // Add this
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'  // Add this
        }
  2. Create a new file under android/app/ and name it "proguard-rules.pro"
  3. Insert these lines to :
    #Flutter Wrapper
    -keep class io.flutter.app.** { *; }
    -keep class io.flutter.plugin.**  { *; }
    -keep class io.flutter.util.**  { *; }
    -keep class io.flutter.view.**  { *; }
    -keep class io.flutter.**  { *; }
    -keep class io.flutter.plugins.**  { *; }
    -keep class io.agora.**  {*;}

Finally, make sure that your Agora project stage supports live.

delwar36 commented 3 years ago

The issue has been resolved for me. Thanks !

I tried the solution given on the readme.md. But still crashing the app. How did you solve that?

luantrasel commented 3 years ago

I also followed solution on readme.md and app is still crashing for me as well

LichKing-2234 commented 3 years ago

pls provide the error log

delwar36 commented 3 years ago

pls provide the error log

When I run command flutter run --release it works fine. But when I build apk file and try to install and open it, the app crashes. How can I get the log in this case?

LichKing-2234 commented 3 years ago

Android: from adb logcat iOS: get the .crash file

DallingtonAsin commented 1 year ago

hey, check android.enableR8=true in your gradle.properties set this to your android/app/build.gradle, and try again

buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled false
            shrinkResources false
        }
}

I have done both of these, also there are many solutions in that thread. Can you please tell me one universal solution because I've tried different versions of those and they are not working. Thank you

Yes, this was very helpful. I was using agora in react-native and this solution fixed the above "App Crash in Release Mode" bug. Thank you @HardikkMadaan

darul9061 commented 10 months ago

This issue still persist