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

android 闪退 #13

Closed
snglw07 opened this issue Apr 24, 2019 · 6 comments · Fixed by #14
Closed

android 闪退 #13

snglw07 opened this issue Apr 24, 2019 · 6 comments · Fixed by #14

Comments

@snglw07
Copy link

snglw07 commented Apr 24, 2019

能在x86Android上正常运行,但 在 MI8,vivo Y67上无法正常运行,一打开,就闪退了

@plutoless
Copy link
Contributor

#11 应该是一个问题 这边看一下logcat看是不是提示没找到flutter.so

@snglw07
Copy link
Author

snglw07 commented Apr 24, 2019

是的 04-24 17:19:01.696 20034 20034 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/io.agora.agorartcengineexample-1/base.apk"],nativeLibraryDirectories=[/data/app/io.agora.agorartcengineexample-1/lib/arm, /data/app/io.agora.agorartcengineexample-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]] couldn't find "libflutter.so"
但是 加了 abiFilters 'armeabi-v7a' 后 再 flutter build apk --target-platform=android-arm64 打包
lib 目录下 libflutter.so也没打进去,怎么弄呢,
lib 目录下 始终只有 libagora-rtc-sdk-jni.so 和 libcrypto.so

@snglw07
Copy link
Author

snglw07 commented Apr 24, 2019

解决了
ndk{
abiFilters "armeabi-v7a"
}

flutter build --release
谢谢

@koudle
Copy link
Contributor

koudle commented Apr 26, 2019

@plutoless

flutter/flutter#18494 (comment)

这个问题在 Flutter 上也有 issue ,应该是 Flutter 在打包的时候,32位、64位中只会有一个打进去,按道理来说,如果只是本地debug,不管你是模拟器,还是32位的手机,还是64位的手机,Flutter 会根据你打包时选择的机器的类型来打包,所以本地debug应该不会有这个问题,只有打release才有这样的问题。

我手机是64位的,在手机上debug,会crash,之所以有问题,应该是 d1c2ec9 这次改动引起的,这里加了armeabi-v7a 和 x86,但是没有加 arm64-v8a

  • 所以一种解决办法就是:
    ndk{abiFilters "armeabi-v7a",'x86',} 这样的配置删掉,这个debug肯定没有问题
  • 另一种解决办法是:
    把ndk的配置补充全,把64位的也加上,就是ndk {abiFilters 'armeabi-v7a', 'x86','arm64-v8a' }

为了兼顾 release 模式,可以暂时采用第二种解决方法,但是正式发布绝对不能用第二种方法,因为还包含了 x86 的 so

@guohai
Copy link

guohai commented Apr 27, 2019

感觉如果 flutter 不修复的话,应用只能是些 workaround,比如可以使用 buildTypes 来设置不同的打包架构(但应该也没有根本的办法解决问题)

debug { minifyEnabled false }

release { minifyEnabled false ndk { abiFilters 'arm64-v8a' } }

正式的发版的话,现在看起来都是使用 spilt apks,可能目前没有考虑到部分国内独特的发布方式(直接 apk 发布)

@koudle
Copy link
Contributor

koudle commented Apr 28, 2019

@guohai 对,但这个应该只有在打 release 包的时候才会有这样的问题,用debug是不会有问题的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants