5

I added a new android wear module based on this Google doc

but I am getting the error described in the title. Here is my layout.

<?xml version="1.0" encoding="utf-8"?>
<android.support.wear.widget.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/dark_grey"
    android:padding="@dimen/box_inset_layout_padding"
    tools:context=".MainWearActivity"
    tools:deviceIds="wear">  

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="@dimen/inner_frame_layout_padding"
        app:boxedEdges="all">  <---this is the offending line 

        <android.support.v7.widget.AppCompatTextView
            android:id="@+id/text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/hello_world" />

    </FrameLayout>
</android.support.wear.widget.BoxInsetLayout>

Anyone know what's going on? I appreciate explanation as to why I am getting this error. UPDATE: I removed the redundant android prefix. Android studio requires me to change the app prefix to change to android but even after doing so the error remains. Is it safe time to assume it is a bug?

The_Martian
  • 3,684
  • 5
  • 33
  • 61
  • 1
    Hmm, that's odd. It's specifically pointing to an attribute with the `tools` prefix, but it's complaining about `app`? You have the `xmlns:android="http://schemas.android.com/apk/res/android"` declaration there twice. Try removing one of those, and see if that was the issue. – Mike M. Dec 07 '18 at 22:12
  • @Mike M, please see the update. – The_Martian Dec 07 '18 at 22:23
  • Dunno. Is it still the same error message? – Mike M. Dec 07 '18 at 22:27
  • @Mike M, I screwed up. The error was and is at the app:boxededges and not at tools. I have corrected it now. Sorry for wasting your time. I was in a hurry to go home and made that mistake. – The_Martian Dec 07 '18 at 22:35
  • 2
    That makes more sense. I'm assuming that attribute is actually used by the `BoxInsetLayout` to apply some sort of visual effect to that child. Android Studio might just be confused because it's on a non-support library `View`. Is it just a warning? Can you suppress it? Put your cursor on that line, hit alt-enter, and see if there's a "Suppress..." option in the pop-up menu. – Mike M. Dec 07 '18 at 22:54
  • Wait, did I misunderstand? Do you mean you've fixed the issue? – Mike M. Dec 08 '18 at 00:22
  • No, I meant I corrected my question. I suppressed the error but I am getting the following when I run it on the emulator. Caused by: android.view.InflateException: Binary XML file line #19: Binary XML file line #19: Error inflating class android – The_Martian Dec 08 '18 at 06:55
  • We'd need to see the complete stack trace. – Mike M. Dec 08 '18 at 06:58
  • The error I mentioned right before this comment was caused by the the AppCompatTextView. I simply changed it to regular textview and it compiles fine. If you make your comment an answer I will accept it as an answer so others can learn from it. – The_Martian Dec 08 '18 at 07:00
  • Oh, it's cool. Just a quick suggestion. Nothing major. Please feel free to post an answer of your own that explains how to access that menu, and what exactly that Suppress option added to your layout to get rid of the warning. I don't actually know. :-) Thank you, though. I appreciate the offer. Glad you got it working. Cheers! – Mike M. Dec 08 '18 at 07:11

1 Answers1

8

Based on what Mike M suggested, I right clicked on the error and I selected suppress in Android studio. My Framelayout now looks like this. I do not however currently know what caused the warning.

<FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="@dimen/inner_frame_layout_padding"
        app:boxedEdges="all"
        tools:ignore="MissingPrefix">

This seems to work for now.

The_Martian
  • 3,684
  • 5
  • 33
  • 61
  • I still get this all the time. This bandaid works, but I would have thought it would be resolved by this point. – lcj Jan 12 '21 at 13:51
  • Very interesting. I followed documentation and used `app:layout_boxedEdges="all"`, but it raises compile time error. `app:boxedEdges="all"` shows red, but when I suppress as per your solution, it's working magically. It's 2021 and still the same! – NightFury Jun 26 '21 at 16:56