Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Flutter Build #7

Closed
Skquark opened this issue Apr 15, 2019 · 12 comments
Closed

Problems with Flutter Build #7

Skquark opened this issue Apr 15, 2019 · 12 comments
Assignees

Comments

@Skquark
Copy link

Skquark commented Apr 15, 2019

I've been trying to integrate this with my Flutter project, but having some issues I hope is fixable. Simply by adding the dependency to my yaml, it adds 17MB to my apk size (doubling my project size) and when I try to run it on my Android 8 LG phone, it immediately crashes giving no errors. However, it does run on the Android 9 emulator for debug build, which is strange.
As a side note, for my app I only need the real-time voice features, not the video.. So it would be nice if there's a separate release of Agora Voice Engine for Flutter without the Video parts.... Thanks, hope I can get this functional soon since it's the last major feature of my app holding me back from release.

@PRWrl
Copy link

PRWrl commented Apr 15, 2019

For the crash, have you permitted camera and microphone accessing for your app?

@Skquark
Copy link
Author

Skquark commented Apr 15, 2019

In my AndroidManifest I had the basic android.permission.CAMERA, android.permission.RECORD_AUDIO, etc, but now that you mentioned it, I dug into your Quickstart Guide - Integrating the SDK and found your full list of needed permissions. That part should be mentioned in your dartlang.org package page, along with the needed setup steps.
I can't quite tell which parts of your Android guide applies to the Dart/Flutter wrapper, the install should be made clearer. Just to be safe, I did the extra steps of adding the sourceSets in gradle, and the Sync with Gradle, installed Android NDK, put AppID, and all the Android Studio stuff I haven't had to do before. I did get an error when I tried to add implementation fileTree(dir: '../../../libs', include ['*.jar']) so I left that out.
So I went through that and tried again several times, but it still crashes immediately on phone (LG V20) and works in emulator. Any other thoughts?

@plutoless
Copy link

@Skquark any crash logs?

@Skquark
Copy link
Author

Skquark commented Apr 15, 2019

I didn't have any crash logs because it happens after I do a build apk and install the release on phone, not in emulator. So this time I connected my phone to usb and did a flutter run, and the debug build ran normally! Good, but more frustrating because I can't get an error log. Did a flutter build apk again and deployed, and it's still crashing... So there's something different about the release builds. Any idea that that could mean?
As a reminder, I haven't added any Agora code in the app, this is just from including it in pubspec.yaml .. Thanks for helping.

@PRWrl
Copy link

PRWrl commented Apr 16, 2019

If your device is arm64, your app will be marked as 64 bit as it finds libraries in lib/arm64-v8a within the APK (Agora video sdk contained arm64 architect).

But currently, flutter is not shipping “libflutter.so” in arm64. So will get an Exception: couldn't find "libflutter.so" . You can use adb logcat to verify if is this issue.

Fix:
Use "abiFilters" in build.gradle to select only "armeabi-v7a":

android {
    ..
    defaultConfig {
        ..
         ndk {
             abiFilters 'armeabi-v7a'
        }
        ..
    }
    ..
}

@Skquark
Copy link
Author

Skquark commented Apr 16, 2019

Excellent, that did the trick. It's now working on my device, I can get back to the implementation now. Still have more testing to do to confirm it's all compatible, hope it passes the iPhone test too..
As a bonus, my apk size went from 36MB down to 24MB after adding the abiFilter! It still adds ~5MB to the build and the largest package size I know of in the Flutter/Dart collection, but worth it if it does the job.
Thanks for the quick solution, that step should be included in AgoraRtcEngine Getting Started Guide.

A side question I had: Is there a way to reduce the latency of a voice stream to be near real-time if the devices are connected to the same local WiFi network? One of the features I'm using this for in my app is to use phones as a live mic to a big speaker, and if there's little delay, people will be happy..
Thank you again.

@Skquark
Copy link
Author

Skquark commented Apr 16, 2019

Update: It works on the release build apk, but now it doesn't work in the emulator.. Here is the error I now get:
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install C:....\build\app\outputs\apk\app.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]

I tried debugging it, attempting to do something with a suggested method using splits { abi { however I couldn't get it to work correctly. I also tried my other AVD emulator that's x86, but didn't launch there either. This area is not my expertise, so feeling a bit lost in the complications of the build.gradle, I appreciate the assistance.

@PRWrl
Copy link

PRWrl commented Apr 17, 2019

Your can add 'x86' in abiFilters to make the x86 emulator work.
abiFilters 'armeabi-v7a', 'x86'

@maheshj01
Copy link

If your device is arm64, your app will be marked as 64 bit as it finds libraries in lib/arm64-v8a within the APK (Agora video sdk contained arm64 architect).

But currently, flutter is not shipping “libflutter.so” in arm64. So will get an Exception: couldn't find "libflutter.so" . You can use adb logcat to verify if is this issue.

Fix:
Use "abiFilters" in build.gradle to select only "armeabi-v7a":

android {
    ..
    defaultConfig {
        ..
         ndk {
             abiFilters 'armeabi-v7a'
        }
        ..
    }
    ..
}

after adding this if you debug the app keeps crashing and doesnt open

@plutoless
Copy link

@maheshmnj if debug in emulator you will need to add x86 as well

@nikhilmufc7
Copy link

If your device is arm64, your app will be marked as 64 bit as it finds libraries in lib/arm64-v8a within the APK (Agora video sdk contained arm64 architect).

But currently, flutter is not shipping “libflutter.so” in arm64. So will get an Exception: couldn't find "libflutter.so" . You can use adb logcat to verify if is this issue.

Fix:
Use "abiFilters" in build.gradle to select only "armeabi-v7a":

android {
    ..
    defaultConfig {
        ..
         ndk {
             abiFilters 'armeabi-v7a'
        }
        ..
    }
    ..
}

Hi @PRWrl This is perfect for minifying app sizes when using Agora , i just wanted to know if it may cause any crashes in releases on playstore in future , can this be used while shipping apps in production?

@github-actions
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please raise a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants