问题描述
我最近偶然发现了一个问题与Android 4.0.3,其中林尽快得到以下异常在应用程序启动(在其他Android版本,它工作正常):
I have recently stumbled upon an issue with android 4.0.3, where Im getting the following Exception as soon as the application starts (on other android versions it works fine):
java.lang.NullPointerException
at android.view.GLES20RecordingCanvas.drawPatch(GLES20RecordingCanvas.java:97)
at android.graphics.NinePatch.draw(NinePatch.java:125)
at android.graphics.drawable.NinePatchDrawable.draw(NinePatchDrawable.java:189)
at android.widget.ImageView.onDraw(ImageView.java:892)
at android.view.View.draw(View.java:10978)
at android.view.ViewGroup.drawChild(ViewGroup.java:2887)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10415)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10380)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10380)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10380)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10380)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:842)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:1910)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1634)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
这涉及具有硬件加速启用,只要我禁用它在清单中的应用程序开始工作就好了。
This is related to having hardware acceleration enabled, as soon as I disable it on the manifest the application starts working just fine.
这样做搜索,我发现一个登录(里面那个文档搜索上罗曼盖伊的一些谈话,在那里他讨论什么可能会造成这一点,虽然目前还没有解决方法或修复提出了drawPatch),我不知道我是否应该禁用硬件加速仅为此版本的Android ,或者如果有解决方法吗?
By doing a search I found a log (inside that doc search for "drawPatch") on some conversation of Romain Guy, where he discuss a little bit of what could be causing this, although there is no workaround or fix proposed, I wonder if I should disable hardware acceleration only for this version of android, or if there is a workaround for it?
感谢您的时间。
推荐答案
所以AC提到这在他的评论,但让我解释。
So A-C mentions this in his comment but let me elaborate.
您可以创建一个值文件布尔值和坚持在正确的版本的文件夹。在您的清单下
看看这篇文章: https://plus.google.com/+AndroidDevelopers/posts / DcsFABkyuYM 。
You can create a boolean in a values file and stick it in the correct version folder. In your manifest under
Check out this post: https://plus.google.com/+AndroidDevelopers/posts/DcsFABkyuYM.
看起来你会想目标值-V15 / bools.xml
Looks like your going to want to target values-v15/bools.xml
<一个href="http://developer.android.com/reference/android/os/Build.VERSION_$c$cS.html#ICE_CREAM_SANDWICH_MR1" rel="nofollow">http://developer.android.com/reference/android/os/Build.VERSION_$c$cS.html#ICE_CREAM_SANDWICH_MR1
这篇关于有没有一种方法来禁用硬件加速只为Android 4.0.3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!