Android – 只能使用armeabi构建的应用程序运行在armeabi-v7a设备上?

前端之家收集整理的这篇文章主要介绍了Android – 只能使用armeabi构建的应用程序运行在armeabi-v7a设备上?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Xamarin documentation这个有点不清楚.如果我建立我的应用程序只有armeabi勾选在构建首选项,我的应用程序:

>可以在Play商店中使用v7a设备吗?
>在v7a设备上运行?

如果它运行,是否有任何功能,如使用线程将导致意外的行为或崩溃?

我有一个简单的应用程序,并试图保持它的小.另外,我没有一个v7a设备做一个快速的实验.

澄清:

虽然似乎有明确的接受,编译只有amreabi图书馆的Android应用程序是“安全但不是很好”(见这个优秀的帖子:Why use armeabi-v7a code over armeabi code?),我认为Xamarin docs on CPU architecture适用于他们编译的.so库说:

it is important to remember that the armeabi runtime used by
Xamarin.Android is thread safe. If an application that has armeabi
support is deployed to an armeabi-v7a device,many strange and
unexplainable exceptions will occur.

我已经能够测试我的应用程序,只是使用armeabi在v7a设备上编译,并没有遇到任何“奇怪和不可解释的例外”YET.

更新:

看来Xamarin文档已经更新了,现在(2014-07-14)读到:

it is important to remember that the armeabi runtime used by
Xamarin.Android is not thread safe. If an application that has
armeabi support is deployed to an armeabi-v7a device,many strange
and unexplainable exceptions will occur.

解决方法

根据Xamarin Android文档,armeabi代码将以意想不到的方式在多核armeavi-v7设备上崩溃.

http://docs.xamarin.com/guides/android/advanced_topics/cpu_architecture

Section 1.1

Note: Xamarin.Android’s armeabi code is not thread safe and should not
be used on multi-cpu armeabi-v7a devices (described below). Using
aremabi code on a single-core armeabi-v7a device is safe.

Xamarin Android使其包含armeabi-v7a的一个要求与线程安全内存访问有关.简单地说,armeabi指令集缺少安全锁定内存在SMP设备上所需的指示.

关于这个问题的最彻底的讨论可以在这个bug报告:https://bugzilla.xamarin.com/show_bug.cgi?id=7013中找到

Jonathan Pryor 2012-09-20 11:41:45 EDT

As far as I can determine,it is (nearly) IMPOSSIBLE to SAFELY use an armeabi
library on a SMP armeabi-v7a device. This is because armeabi lacks the cpu
instructions necessary to safely lock data on SMP devices,so if the armeabi
library contains data that must be protected against access from multiple
threads,it’s busted,and libmonodroid.so is such a library. This may be
fixable by creating a libmonodroid.so which dynamically determines the runtime
cpu,allowing it to use either armeabi or armeabi-v7a lock instructions
accordingly,but this has not been done yet,and the implementation timeframe
is unknown.

Thus,if your app will be running on SMP hardware,you should include the
armeabi-v7a runtime with your app. This can be done in the Project Options
dialog.

这些崩溃是罕见的,但灾难性的并且很难调试,因为您遇到随机内存损坏和分段错误.

我能够在Galaxy S3上可靠地重现问题.一些演示崩溃的示例代码是在此错误报告中:https://bugzilla.xamarin.com/show_bug.cgi?id=7167

这个bug是否影响Android上的其他NDK应用程序是未知的.但它肯定会影响Xamarin Android.

原文链接:https://www.f2er.com/android/311573.html

猜你在找的Android相关文章