Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
[XWALK-7214] Android N: TextureView throws exception in XWalkView constructor Created: 05/Aug/16 Updated: 16/Mar/17 Resolved: 25/Sep/16 Status: Project: Component/s: Affects Version/s: Fix Version/s: Closed Crosswalk Project Crosswalk Project for Android Crosswalk 20, Crosswalk 21 Type: Reporter: Resolution: Labels: Remaining Estimate: Time Spent: Original Estimate: Environment: Bug Priority: Julian Dropmann (Inactive) Assignee: Won't Fix Votes: None Not Specified Attachments: AndroidManifest.xml Crosswalk-help Crosswalk 23 to be our last release.msg MainActivity.java build.gradle build.gradle device-2016-08-08-162500.png log.txt Issue Links: Relates relates XWALKto 7401 OS: Platform/s: Severity: Reporter Domain: None P2 Zhang Xiaofeng 0 Not Specified Not Specified Android N Developer Preview 5 TextureView is not working on Android... Android Tablet ARM Critical dropmann.org (Find related issues) Description Impacted Cases ============== Using animatable XWalkView with Android N. Reproduce Test Steps ==================== Resolved XWalkPreferences.setValue(XWalkPreferences.ANIMATABLE_XWALK_VIEW, true); new XWalkView(this) Expected Outcome ================ No crash/exception. Actual Outcome ============== java.lang.RuntimeException: java.lang.UnsupportedOperationException: TextureView doesn't support displaying a background drawable at org.xwalk.core.ReflectConstructor.newInstance(ReflectConstructor.java:54) at org.xwalk.core.XWalkView.reflectionInit(XWalkView.java:1882) at org.xwalk.core.XWalkView.<init>(XWalkView.java:340) Caused by: java.lang.UnsupportedOperationException: TextureView doesn't support displaying a background drawable at android.view.TextureView.setBackgroundDrawable(TextureView.java:302) at android.view.View.setBackground(View.java:18120) at android.view.View.setBackgroundColor(View.java:18082) at org.chromium.content.browser.ContentViewRenderView.initTextureView(ContentViewRenderView.java:68) at org.chromium.content.browser.ContentViewRenderView.<init>(ContentViewRenderView.java:145) at org.xwalk.core.internal.XWalkContent$2.<init>(XWalkContent.java:177) at org.xwalk.core.internal.XWalkContent.setNativeContent(XWalkContent.java:177) at org.xwalk.core.internal.XWalkContent.<init>(XWalkContent.java:136) at org.xwalk.core.internal.XWalkViewInternal.initXWalkContent(XWalkViewInternal.java:441) at org.xwalk.core.internal.XWalkViewInternal.<init>(XWalkViewInternal.java:386) at org.xwalk.core.internal.XWalkViewBridge.<init>(XWalkViewBridge.java:80) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:430) at org.xwalk.core.ReflectConstructor.newInstance(ReflectConstructor.java:48) at org.xwalk.core.XWalkView.reflectionInit(XWalkView.java:1882) at org.xwalk.core.XWalkView.<init>(XWalkView.java:340) Test Case Source Code ===================== build.gradle https://crosswalk-project.org/jira/secure/attachment/15633/build.gradle app/build.grade https://crosswalk-project.org/jira/secure/attachment/15634/build.gradle AndroidManifest.xml https://crosswalk-project.org/jira/secure/attachment/15635/AndroidManifest.xml MainActivity.java https://crosswalk-project.org/jira/secure/attachment/15636/MainActivity.java Process Log https://crosswalk-project.org/jira/secure/attachment/15638/log.txt https://crosswalk-project.org/jira/secure/attachment/15637/device-2016-08-08Device About 162500.png Test Builds =========== 20.50.533.12 failed 21.51.546.3 failed Issue Analysis ============== android.view.TextireView.setBackgroundColor / setBackground / setBackgroundDrawable seems not to be supported on Android N Comments Comment by Cao Can [ 08/Aug/16 ] I cannot reproduce this issue with Android N on crosswalk 21.51.546.3 Test Case Source Code ===================== animatable https://github.com/crosswalk-project/crosswalk-test-suite/blob/master/usecase/usecase-em android-tests/embeddingapi/src/org/xwalk/embedded/api/sample/basic/XWalkViewWithA setBackgroundColor https://github.com/crosswalk-project/crosswalk-test-suite/blob/master/usecase/usecase-em androidtests/embeddingapi/src/org/xwalk/embedded/api/sample/basic/XWalkViewWithSetBackg Comment by Julian Dropmann (Inactive) [ 08/Aug/16 ] Cao Can I created a test app and can confirm that even with a default app only the first two lines of code in onCr necessary in order to reproduce the issue: Tested with minSdkVersion 16 and 24 and crosswalk 20.50.533.12 and 21.51.546.3 (beta) Test Case Source Code ===================== build.gradle https://crosswalk-project.org/jira/secure/attachment/15633/build.gradle app/build.grade https://crosswalk-project.org/jira/secure/attachment/15634/build.gradle AndroidManifest.xml https://crosswalk-project.org/jira/secure/attachment/15635/AndroidManifest.xml MainActivity.java https://crosswalk-project.org/jira/secure/attachment/15636/MainActivity.java Process Log https://crosswalk-project.org/jira/secure/attachment/15638/log.txt Device About https://crosswalk-project.org/jira/secure/attachment/15637/device-2016-08-08-162500.p I installed Android N (NPD90G) using the OTA Update through Android Beta Program, if that might be relevan Comment by Julian Dropmann (Inactive) [ 08/Aug/16 ] Cao Can I think I figured it out, It seems that you cannot reproduce the issue because you set the preferences and XWalkView in onXWalkReady instead of in onCreate. If you do it as the docs describe (or without XWalkActivity even), you will be able to reproduce the crash: https: project.org/apis/embeddingapidocs_v6/org/xwalk/core/XWalkActivity.html It does not seem to be generally applicable though because in our production app, I get the error even when I wa onXWalkReady (using XWalkActivityDelegate). Comment by Julian Dropmann (Inactive) [ 23/Aug/16 ] Cao Can Lin Sun Balestrieri, Francesco Any progress on this? I think there should be enough info to reproduce t Comment by Balestrieri, Francesco [ 23/Aug/16 ] Lin Sun can you assign to someone? Comment by Lin Sun [ 23/Aug/16 ] xu xing Could you help to investigate this issue and make it a priority? Comment by Cao Can [ 07/Sep/16 ] Zhang Xiaofeng,I cannot reproduce this issue with crosswalk 20.50.533.12 and crosswalk 23.52.568.0. The source code is : https://crosswalk-project.org/jira/secure/attachment/15636/MainActivity.java Comment by Zhang Xiaofeng [ 07/Sep/16 ] Julian Dropmann we can't reproduce this issue using your sample code on Android N device (nexus9) Comment by Valentin Krasznai (Inactive) [ 13/Sep/16 ] Zhang Xiaofeng, I have exactly the same issue on a Nexus 5X with Android 7.0. I run the same code that Julian attached, just with 21.51.546.6. I used Android Studio to build an apk, then installed it to the phone. Comment by Zhang Xiaofeng [ 13/Sep/16 ] Valentin Krasznai could you just use https://crosswalk-project.org/jira/secure/attachment/15636/MainActivity.ja new Android Studio project to try? if the issue still happens, please provide more details on how to reproduce it. Comment by Julian Dropmann (Inactive) [ 14/Sep/16 ] Zhang Xiaofeng Sorry but I do not see any variable which is not already present here: Given you use the same hardware, same system image and same app source code, there are not much details to p Also the exception/stack trace is so specific, that just by analyzing the source you should be able to find the setB call in initTextureView, which according to the exception is not supported for TextureView. So honestly what information are you looking for? Its everything present here. I btw. volunteer to test your fix, because I can reproduce this with no issues at all. Comment by Valentin Krasznai (Inactive) [ 16/Sep/16 ] Zhang Xiaofeng I tried with your MainActivity.java, and the issue still happens. This line is the cause: mXWalkView = new XWal Here is the stack trace. Caused by: java.lang.UnsupportedOperationException: TextureView doesn't support displaying a background dr at android.view.TextureView.setBackgroundDrawable(TextureView.java:302) at android.view.View.setBackground(View.java:18120) at android.view.View.setBackgroundColor(View.java:18082) at org.chromium.content.browser.ContentViewRenderView.initTextureView(ContentViewRenderView.java:68) at org.chromium.content.browser.ContentViewRenderView.<init>(ContentViewRenderView.java:145) at org.xwalk.core.internal.XWalkContent$2.<init>(XWalkContent.java:177) at org.xwalk.core.internal.XWalkContent.setNativeContent(XWalkContent.java:177) at org.xwalk.core.internal.XWalkContent.<init>(XWalkContent.java:137) at org.xwalk.core.internal.XWalkViewInternal.initXWalkContent(XWalkViewInternal.java:454) at org.xwalk.core.internal.XWalkViewInternal.<init>(XWalkViewInternal.java:399) at org.xwalk.core.internal.XWalkViewBridge.<init>(XWalkViewBridge.java:80) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:430) at org.xwalk.core.ReflectConstructor.newInstance(ReflectConstructor.java:48) at org.xwalk.core.XWalkView.reflectionInit(XWalkView.java:1915) at org.xwalk.core.XWalkView.<init>(XWalkView.java:353) at com.example.kval.andoidn.MainActivity.onCreate(MainActivity.java:16) These two lines seems interesting: at org.chromium.content.browser.ContentViewRenderView.initTextureView(ContentViewRenderView.java:68) at org.chromium.content.browser.ContentViewRenderView.<init>(ContentViewRenderView.java:145) They are from Chromium 51 according to my Android Studio, but the android.view.TextureView is from Androi and maybe these classes are not compatible. UPDATE You should just remove/ignore this.mTextureView.setBackgroundColor(-1); from org.chromium.content.browser.ContentViewRenderView, when the Android build version is greater than or equ Comment by Zhang Xiaofeng [ 17/Sep/16 ] Valentin Krasznai I know why I can't reproduce the issue. That's because you use Android SDK 24 to build and targetSdkVersion is 23. However, ContentViewRenderView.java is Chromium upstream code, so we can't change it. Can targetSdkVers request currently? Comment by Valentin Krasznai (Inactive) [ 20/Sep/16 ] Yes, it can work for me as a temporary solution, thanks! But I want to update the targetSdkVersion to 24 as soon do you know which Crosswalk will support the targetSdkVersion 24? Comment by Zhang Xiaofeng [ 20/Sep/16 ] Sorry, it depends on when Chromium build targetSdkVersion will be upgrade to 24.. Comment by Valentin Krasznai (Inactive) [ 22/Sep/16 ] I see, thank you! Comment by Hua Hou [ 16/Mar/17 ] Zhang Xiaofeng: Looks like that Chromium has bumped targetSdkVersion to 24: https://codereview.chromium.org/2570283002 Is there an XWalk beta version which uses the latest Chromium? I am still getting the "TextureView doesn't support displaying a background drawable" error when using the late version 23.53.589.4 Thanks. Comment by Zhang Xiaofeng [ 16/Mar/17 ] sorry, Crosswalk project had already been stopped. please see the attached. Comment by Hua Hou [ 16/Mar/17 ] Sorry to hear that and thank you for the update. Generated at Sat May 13 16:26:05 PDT 2017 using JIRA 7.2.7#72009sha1:68b7d86b7e8716f76c1f28a5095acccf67bb75b1.