Как решить android связывание ресурсов не удалось? - PullRequest
0 голосов
/ 08 января 2020

это ошибка, которую я получаю, когда пытаюсь запустить приложение. Я не знаю, как решить эту проблему. Моя среда разработки рекомендует перенести на androidx, но она не запускается, когда я пытался это сделать. Вся помощь может быть полезна для меня. спасибо!

Android resource linking failed
    C:\Users\hp\AndroidStudioProjects\Surv_pt1\app\src\main\res\layout\activity_signup.xml:81: AAPT: error: resource style/Widget.MaterielComponents.TextInputLayout.OutlineBox (aka com.example.surv_pt1:style/Widget.MaterielComponents.TextInputLayout.OutlineBox) not found.

C:\Users\hp\AndroidStudioProjects\Surv_pt1\app\src\main\res\layout\activity_signup.xml:81: AAPT: error: resource dimen/margin_8dp (aka com.example.surv_pt1:dimen/margin_8dp) not found.

соответствующий код файла xml

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    tools:context=".signupActivity">
    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        android:minHeight="?attr/actionBarSize"
        app:theme="@style/ThemeOverlay.AppCompat.Dark">
        <ImageButton
            android:id="@+id/helpButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginRight="2dp"
            app:srcCompat="@drawable/ic_help_black_24dp"
            android:layout_gravity="right"
            android:background="?attr/colorPrimary"
            tools:ignore="VectorDrawableCompat" />
    </androidx.appcompat.widget.Toolbar>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <LinearLayout
            android:id="@+id/imageAndText"
            android:layout_width="match_parent"
            android:layout_height="435dp"
            android:layout_weight="1"
            android:orientation="vertical">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical">
                <TextView
                    android:id="@+id/textView2"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:text="TextView" />
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical">
                <ImageView
                    android:id="@+id/imageView2"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    app:srcCompat="@drawable/ic_person_add_black_24dp"
                    tools:ignore="VectorDrawableCompat" />
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
            android:id="@+id/InfosUser"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical">
                <com.google.android.material.textfield.TextInputLayout
                    style="@style/Widget.MaterielComponents.TextInputLayout.OutlineBox"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/margin_8dp"
                    android:hint="username">
                    <com.google.android.material.textfield.TextInputEditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"/>
                </com.google.android.material.textfield.TextInputLayout>
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"></LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"></LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"></LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"></LinearLayout>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:orientation="vertical"></LinearLayout>
    </LinearLayout>
</LinearLayout>

это зависимости файла gradle (модуль: приложение )

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.surv_pt1"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:19.2.0'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation 'com.google.android.material:material:1.0.0'
}

второй файл Gradle (проект)

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

1 Ответ

0 голосов
/ 08 января 2020

В следующем разделе необходимо удалить некоторые детали.

 <com.google.android.material.textfield.TextInputLayout
                style="@style/Widget.MaterielComponents.TextInputLayout.OutlineBox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/margin_8dp"
                android:hint="username">

Снимите style и замените marginTop. удалить всю строку style="@style/Widget.MaterielComponents.TextInputLayout.OutlineBox". Заменить @dimen/margin_8dp на 8dp. это будет android:layout_marginTop="8dp"

...