java.lang.UnsupportedOperationException: Can not convert to dimension: type = 0x12

0
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="@drawable/bg_criar_conta"
    tools:context="com.dietcode.radiovox.CriarMinhaConta">

    <ImageView
        android:id="@+id/diskId"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="0dp"
        android:layout_marginRight="0dp"
        android:layout_marginStart="8dp"
        app:layout_constraintLeft_toLeftOf="@+id/guidelineEsquerda"
        app:layout_constraintRight_toLeftOf="@+id/guidelineDireita"
        app:layout_constraintTop_toTopOf="@+id/guidelineTop"
        app:srcCompat="@drawable/disk"
        app:layout_constraintHorizontal_bias="0.0"
        android:layout_marginTop="0dp" />

    <TextView
        android:id="@+id/textoCriarContaId"
        android:layout_width="0dp"
        android:layout_height="20dp"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:text="CRIE SUA CONTA"
        android:textAlignment="center"
        android:textAppearance="@style/TextAppearance.AppCompat.Medium"
        android:textStyle="bold"
        app:layout_constraintBottom_toTopOf="@+id/campoNomeId"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="@+id/guidelineEsquerda"
        app:layout_constraintRight_toLeftOf="@+id/guidelineDireita"
        app:layout_constraintTop_toBottomOf="@+id/diskId" />

    <EditText
        android:id="@+id/campoNomeId"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@+id/guidelineDireita"
        android:layout_marginStart="@+id/guidelineEsquerda"
        android:ems="10"
        android:hint="Nome"
        android:inputType="textPersonName"
        app:layout_constraintRight_toLeftOf="@+id/guidelineDireita"
        android:layout_marginRight="8dp"
        android:layout_marginLeft="8dp"
        app:layout_constraintLeft_toLeftOf="@+id/guidelineEsquerda"
        app:layout_constraintHorizontal_bias="0.0"
        android:layout_marginBottom="8dp"
        app:layout_constraintBottom_toTopOf="@+id/campoEmailId" />

    <EditText
        android:id="@+id/campoEmailId"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="0dp"
        android:layout_marginRight="0dp"
        android:layout_marginStart="8dp"
        android:ems="10"
        android:hint="E-mail"
        android:inputType="textEmailAddress"
        app:layout_constraintLeft_toLeftOf="@+id/guidelineEsquerda"
        app:layout_constraintRight_toLeftOf="@+id/guidelineDireita"
        android:layout_marginBottom="8dp"
        app:layout_constraintBottom_toTopOf="@+id/campoSenhaId" />

    <EditText
        android:id="@+id/campoSenhaId"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:ems="10"
        android:hint="Senha"
        android:inputType="textPassword"
        app:layout_constraintLeft_toLeftOf="@+id/guidelineEsquerda"
        app:layout_constraintRight_toLeftOf="@+id/guidelineDireita"
        app:layout_constraintHorizontal_bias="0.0"
        android:layout_marginBottom="8dp"
        app:layout_constraintBottom_toTopOf="@+id/campoConfirmarSenhaId" />

    <EditText
        android:id="@+id/campoConfirmarSenhaId"
        style="@android:style/Widget.EditText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:ems="10"
        android:hint="Confirmar senha"
        android:inputType="textPassword"
        app:layout_constraintBottom_toTopOf="@+id/botaoEntrarId"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="@+id/guidelineEsquerda"
        app:layout_constraintRight_toLeftOf="@+id/guidelineDireita" />

    <android.support.constraint.Guideline
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/guidelineTop"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.16"
        tools:layout_editor_absoluteY="95dp"
        tools:layout_editor_absoluteX="0dp" />

    <android.support.constraint.Guideline
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/guidelineEsquerda"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.17"
        tools:layout_editor_absoluteY="0dp"
        tools:layout_editor_absoluteX="61dp" />

    <android.support.constraint.Guideline
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/guidelineDireita"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.83"
        tools:layout_editor_absoluteY="0dp"
        tools:layout_editor_absoluteX="299dp" />

    <android.support.constraint.Guideline
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/guidelineBotton"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.98" />

    <Button
        android:id="@+id/botaoEntrarId"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:background="@drawable/botao_entrar"
        app:layout_constraintBottom_toTopOf="@+id/possuiContaid"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="@+id/guidelineEsquerda"
        app:layout_constraintRight_toLeftOf="@+id/guidelineDireita" />

    <TextView
        android:id="@+id/possuiContaid"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:text="Já possui uma conta?"
        android:textAlignment="center"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="@+id/guidelineEsquerda"
        app:layout_constraintRight_toLeftOf="@+id/guidelineDireita"
        android:layout_marginBottom="8dp"
        app:layout_constraintBottom_toTopOf="@+id/continueSemLogarId" />

    <TextView
        android:id="@+id/continueSemLogarId"
        android:layout_width="0dp"
        android:layout_height="17dp"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:text="Continue sem logar"
        android:textAlignment="center"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="@+id/guidelineEsquerda"
        app:layout_constraintRight_toLeftOf="@+id/guidelineDireita"
        android:layout_marginBottom="8dp"
        app:layout_constraintBottom_toTopOf="@+id/guidelineBotton" />

</android.support.constraint.ConstraintLayout>
logcat
08-04 11:57:50.581 21423-21423/com.dietcode.radiovox E/AndroidRuntime: FATAL EXCEPTION: main
                                                                       Process: com.dietcode.radiovox, PID: 21423
                                                                       java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dietcode.radiovox/com.dietcode.radiovox.CriarMinhaConta}: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2695)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
                                                                           at android.app.ActivityThread.access$900(ActivityThread.java:177)
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1430)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                           at android.os.Looper.loop(Looper.java:135)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5910)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                           at java.lang.reflect.Method.invoke(Method.java:372)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
                                                                        Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12
                                                                           at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:584)
                                                                           at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:6937)
                                                                           at android.support.constraint.ConstraintLayout$LayoutParams.<init>(ConstraintLayout.java:1662)
                                                                           at android.support.constraint.ConstraintLayout.generateLayoutParams(ConstraintLayout.java:1223)
                                                                           at android.support.constraint.ConstraintLayout.generateLayoutParams(ConstraintLayout.java:383)
                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:808)
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
                                                                           at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:436)
                                                                           at android.app.Activity.setContentView(Activity.java:2245)
                                                                           at com.dietcode.radiovox.CriarMinhaConta.onCreate(CriarMinhaConta.java:16)
                                                                           at android.app.Activity.performCreate(Activity.java:6178)
                                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2648)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769) 
                                                                           at android.app.ActivityThread.access$900(ActivityThread.java:177) 
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1430) 
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                           at android.os.Looper.loop(Looper.java:135) 
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5910) 
                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                           at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405) 
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200) 
    
asked by anonymous 04.08.2017 / 17:10

1 answer

1

In your EditText, remove the attributes android:layout_marginEnd="@+id/guidelineDireita" and android:layout_marginStart="@+id/guidelineEsquerda"

<EditText
        android:id="@+id/campoNomeId"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@+id/guidelineDireita"
        android:layout_marginStart="@+id/guidelineEsquerda"
        ...
        app:layout_constraintBottom_toTopOf="@+id/campoEmailId" />

These attributes expect a measure, not a view.

    
04.08.2017 / 18:57