Unity android project throws “Your hardware does n

2019-03-21 12:35发布

问题:

I have been investigating for 2 days. I have read a lot of things. To summarize what I read:

  • Non-NEON devices will not work with UNITY 5 builds.
  • You should set your Install Location to "Automatic or Force Internal"
  • You should set your Write Access to "Internal Only"

Along with the above ones, I also tried with these texture compression settings:

  • Don't override
  • DXT (Tegra)

Also there are two cases that I tried:

  • When I built the game from UNITY and generate an apk. It worked fine on the phone.
  • I selected "Google Android Project" and exported the unity project. After exporting, I got the /assets/bin/ folder and copy into my android project assets. With this option, it didn't work.

Phones that I tried are Sony Xperia M5 and One Plus 2. Both of them have ARM Cortex-A53 CPUs. Hence, the Non-NEON option is eliminated I think. I think that there should be another reason causing this problem.

By the way, the game works on both cases on s5, s6, s3 mini and Xperia Z1.

Thanks in advance.

回答1:

A friend in the Android team found that native libraries missing after integration with fresco which is a powerful system for displaying images in Android applications. Also, there is an issue on the fresco's github page: https://github.com/facebook/fresco/issues/361

In there, a man whose nickname is kassim says that "A common issue with native libs on Android is that if one native lib is available for an abi then all your native libs need to be available for that abi, it won't fall back to a lower supporting abi, so x86_64 won't fall back to x86".

He offers putting the code below into the android section of build.gradle file:

packagingOptions {
    exclude "lib/armeabi/libbitmaps.so"
    exclude "lib/armeabi/libgifimage.so"
    exclude "lib/armeabi/libimagepipeline.so"
    exclude "lib/armeabi/libmemchunk.so"
    exclude "lib/armeabi/libwebp.so"
    exclude "lib/armeabi/libwebpimage.so"
    exclude "lib/arm64-v8a/libbitmaps.so"
    exclude "lib/arm64-v8a/libgifimage.so"
    exclude "lib/arm64-v8a/libimagepipeline.so"
    exclude "lib/arm64-v8a/libmemchunk.so"
    exclude "lib/arm64-v8a/libwebp.so"
    exclude "lib/arm64-v8a/libwebpimage.so"
    exclude "lib/x86_64/libbitmaps.so"
    exclude "lib/x86_64/libgifimage.so"
    exclude "lib/x86_64/libimagepipeline.so"
    exclude "lib/x86_64/libmemchunk.so"
    exclude "lib/x86_64/libwebp.so"
    exclude "lib/x86_64/libwebpimage.so"
}

This solved the problem.