Error: error: '' is incompatible with attribute android: layout_weight (attr) float. and "R" red

0

I have the following error:

And this is the code he sends me to:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.carrduci.inventario.actividades.DetalleRefaccion">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:background="#cccccc"
            >

            <TextView
                android:id="@+id/codigoInterno"
                android:layout_width="0dip"
                android:layout_height="wrap_content"
                android:text="W.281"
                android:layout_weight="1"
                android:textSize="30dp"
                android:gravity="center_vertical"
                android:paddingLeft="10dp"
                />

            <TextView
                android:id="@+id/codigoExterno"
                android:textSize="20dp"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="XSKDF254"
                android:layout_weight="2"
                android:gravity="center"
                android:paddingRight="10dp"
                />


        </LinearLayout>

        <TextView
            android:id="@+id/nombreRefaccion"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="REFACCION TAL POR CUAL "

            android:padding="10dp"
            android:background="#454545"
            android:textColor="#ffffff"
            android:textSize="20dp"

            />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:paddingTop="2dp"
                >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="center"
                    >


                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical"
                        android:layout_weight="2"

                        >

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:text="MIN "
                            android:gravity="center"
                            android:textSize="20dp"
                            android:layout_weight="3"
                            android:background="#606060"
                            android:textColor="#ffffff"

                            />

                        <TextView
                            android:background="#eeeeee"
                            android:id="@+id/stockMinimo"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:text="10.00 "
                            android:gravity="center"
                            android:layout_weight=""
                            android:textSize="20dp"
                            />

                    </LinearLayout>


                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical"
                        android:layout_weight="1"
                        >
                        <TextView
                            android:id="@+id/existencia"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:text="--.-- "
                            android:textSize="45dp"
                            android:gravity="center"

                            />



                        <TextView
                            android:id="@+id/unidad"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:text="------- "
                            android:gravity="center"
                            android:textSize="25dp"


                            />





                    </LinearLayout>


                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical"
                        android:layout_weight="2"

                        >




                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:text="MAX "
                            android:gravity="center"
                            android:textSize="20dp"
                            android:layout_weight="3"
                            android:background="#606060"
                            android:textColor="#ffffff"
                            />

                        <TextView
                            android:background="#eeeeee"
                            android:id="@+id/stockMaximo"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:text="30.00"
                            android:gravity="center"
                            android:layout_weight="1"
                            android:textSize="20dp"
                            />

                    </LinearLayout>

                </LinearLayout>

            </LinearLayout>



        </LinearLayout>


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:background="#eeeeee"
            android:layout_marginTop="2dp"
            >


            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:text="IMPORTANCIA "
                android:padding="5dp"
                android:layout_weight="1"
                android:gravity="center"
                android:background="#606060"
                android:textColor="#ffffff"

                />
            <TextView
                android:layout_weight="1"
                android:id="@+id/importancia"
                android:gravity="center"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:text="ALTA "
                android:textSize="25dp"
                android:background="#eeeeee"

                />

        </LinearLayout>

        <TextView
            android:id="@+id/descripcion"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:paddingLeft="10dp"

            android:text="Esta tiene que ser una descripcion que sea bastante laraga y que permita scroll. "
            android:textSize="25dp"

            android:maxLines = "@android:integer/config_longAnimTime"
            android:scrollbars = "vertical"

            />


    </LinearLayout>


</android.support.constraint.ConstraintLayout>

In a parallel way it shows me that the class "R" can not be solved.

I have also reviewed my manifesto and I have not been able to find a problem:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.carrduci.inventario">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity" />

        <activity
            android:name=".PrincipalCarga"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:label="@string/title_activity_principar_carga"
            android:theme="@style/FullscreenTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".actividades.DetalleRefaccion"></activity>
        <activity android:name=".utilidades.Slider"></activity>
        <activity android:name=".actividades.WelcomeActivity"></activity>

    </application>

</manifest>

EDITED

The Gradle console gives me this message:

Executing tasks: [: app: assembleDebug]

Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
Configuration 'androidTestCompile' in project ':app' is deprecated. Use 'androidTestImplementation' instead.
Configuration 'testCompile' in project ':app' is deprecated. Use 'testImplementation' instead.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources
AGPBI: {"kind":"error","text":"error: \u0027\u0027 is incompatible with attribute android:layout_weight (attr) float.","sources":[{"file":"C:\Users\Particular\AndroidStudioProjects\Inventario\app\src\main\res\layout\activity_detalle_refaccion.xml"}],"original":"","tool":"AAPT"}
C:\Users\Particular\AndroidStudioProjects\Inventario\app\src\main\res\layout\activity_detalle_refaccion.xml:0: error: '' is incompatible with attribute android:layout_weight (attr) float.
error: failed linking file resources.

I tried:

  • Build > Clean project
  • Build & Rebuild project
  • File> Invalidate caches / Restart
  • Direct import with import% co_of%
asked by Angel 10.11.2017 в 23:18
source

2 answers

2

This is what you are saying android studio, in your fifth textView you have as value of the layout_weight some quotes with nothing inside:

You have the following:

android:layout_weight="";

The message he gives you is:

  

'' is incompatible with attribute android: layout_weight (attr) float

Tells you that '' is incompatible with the float value expected in a layout_weight.

You have to enter a value there or remove the attribute.

    
answered by 10.11.2017 / 23:24
source
0

The red R's are mainly caused when you have a problem in a resource, as in this case in a layout.

Android, "R's" red throughout the code

The error you indicate:

tells you that you have an incompatible value to be property value

android:layout_weight=""

you must add a value to this property!

Regarding the errors:

  

Configuration 'compile' in project ': app' is deprecated. Use   'implementation' instead. Configuration 'androidTestCompile' in   project ': app' is deprecated. Use 'androidTestImplementation' instead.   Configuration 'testCompile' in project ': app' is deprecated. Use   'testImplementation' instead. :

You must update the gradle version, review this documentation guide as a reference.

    
answered by 10.11.2017 в 23:30