Связывание ресурсов Android не удалось, несмотря на наличие ресурсов - PullRequest
0 голосов
/ 17 октября 2019

Я использую Android для своего проекта. Это моя ошибка:

FAILURE: сборка не удалась с исключением.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/layout/activity_register.xml:2: AAPT: error: resource drawable/register_user (aka com.example.myapplication:drawable/register_user) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/layout/activity_welcome.xml:8: AAPT: error: resource drawable/round_image (aka com.example.myapplication:drawable/round_image) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/layout/activity_welcome.xml:8: AAPT: error: resource drawable/add_icon (aka com.example.myapplication:drawable/add_icon) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/layout/fragment_home.xml:121: AAPT: error: resource drawable/btn_bg_engagement (aka com.example.myapplication:drawable/btn_bg_engagement) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/layout/fragment_home.xml:132: AAPT: error: resource drawable/btn_bg_mehendi (aka com.example.myapplication:drawable/btn_bg_mehendi) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/layout/fragment_home.xml:150: AAPT: error: resource drawable/btn_bg_sangeet (aka com.example.myapplication:drawable/btn_bg_sangeet) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/layout/fragment_home.xml:158: AAPT: error: resource drawable/btn_style (aka com.example.myapplication:drawable/btn_style) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/layout/img_custom_layout.xml:17: AAPT: error: resource drawable/round_image (aka com.example.myapplication:drawable/round_image) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/layout/img_custom_layout.xml:32: AAPT: error: resource drawable/round_image (aka com.example.myapplication:drawable/round_image) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/layout/nav_header_dashboard.xml:2: AAPT: error: resource drawable/nav_bar_bg (aka com.example.myapplication:drawable/nav_bar_bg) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/menu/activity_dashboard_drawer.xml:8: AAPT: error: resource drawable/ic_dashboard_black_24dp (aka com.example.myapplication:drawable/ic_dashboard_black_24dp) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/menu/activity_dashboard_drawer.xml:16: AAPT: error: resource drawable/ic_favorite (aka com.example.myapplication:drawable/ic_favorite) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/menu/activity_dashboard_drawer.xml:19: AAPT: error: resource drawable/ic_favorite (aka com.example.myapplication:drawable/ic_favorite) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/menu/activity_dashboard_drawer.xml:22: AAPT: error: resource drawable/ic_favorite (aka com.example.myapplication:drawable/ic_favorite) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/menu/activity_dashboard_drawer.xml:25: AAPT: error: resource drawable/ic_favorite (aka com.example.myapplication:drawable/ic_favorite) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/menu/activity_dashboard_drawer.xml:28: AAPT: error: resource drawable/ic_favorite (aka com.example.myapplication:drawable/ic_favorite) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/menu/activity_dashboard_drawer.xml:35: AAPT: error: resource drawable/ic_menu_share (aka com.example.myapplication:drawable/ic_menu_share) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/menu/activity_dashboard_drawer.xml:39: AAPT: error: resource drawable/ic_menu_send (aka com.example.myapplication:drawable/ic_menu_send) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/menu/activity_dashboard_drawer.xml:48: AAPT: error: resource drawable/ic_logout (aka com.example.myapplication:drawable/ic_logout) not found.

     /Users/raajkumarchandiramani/Desktop/AndMAD/ShubhMangalam/MyApplication/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:3: AAPT: error: resource drawable/ic_launcher_background (aka com.example.myapplication:drawable/ic_launcher_background) not found.


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
13 actionable tasks: 10 executed, 3 up-to-date

Это мой код манифеста:

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

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/app_wedding_plan_1"
        android:label="@string/app_name"
        android:roundIcon="@drawable/ic_launcher_foreground"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".DashboardActivity"
            android:theme="@style/AppTheme.NoActionBar">
        </activity>
        <activity android:name=".WelcomeActivity" />
        <activity android:name=".LogoutActivity" />
        <activity android:name=".LoginActivity" />
        <activity android:name=".SplashScreenActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

    <dist:module dist:instant="true" />

</manifest>

app.build.gradle code:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 29
    buildToolsVersion "29.0.1"
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 21
        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.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.navigation:navigation-fragment:2.1.0'
    implementation 'androidx.navigation:navigation-ui:2.1.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation "androidx.cardview:cardview:1.0.0"
    implementation 'com.google.firebase:firebase-core:17.2.0'
    implementation 'com.google.firebase:firebase-auth:19.1.0'
    implementation 'com.google.firebase:firebase-auth:19.1.0'
    implementation 'com.google.firebase:firebase-database:19.2.0'
}
apply plugin: 'com.google.gms.google-services'

Project build.gradle code:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'
        classpath 'com.google.gms:google-services:4.3.2'
        // 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
}

Снимок ошибки

Я пытаюсь собратьмой проект, но каждый раз, когда я получаю ссылку на ресурс Android (ошибка AAPT). Тем не менее, эти файлы присутствуют в моем каталоге ресурсов для рисования. Я попробовал все в сообщениях, похожих на меня, но, похоже, ничего не работает.

Редактировать: activity_register.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    android:background="@drawable/register_user"
    tools:context=".RegisterActivity">

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

        <EditText
            android:layout_margin="8dp"
            android:inputType="text"
            android:hint="Enter your Name"
            android:textColorHint="#000000"
            android:backgroundTint="@color/colorPrimaryDark"
            android:id="@+id/edit_text_name"
            android:textColor="#000000"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>
        <RadioGroup
            android:id="@+id/gender_rg"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="GENDER"
                android:textColor="#000000"
                android:textStyle="bold"
                android:textColorHint="@color/colorPrimary" />
            <RadioButton
                android:id="@+id/gender_male"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="MALE"
                android:layout_marginLeft="160dp"
                android:textColor="#000000"
                android:buttonTint="@color/colorPrimary"/>
            <RadioButton
                android:id="@+id/gender_female"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginLeft="160dp"
                android:text="FEMALE"
                android:textColor="#000000"
                android:buttonTint="@color/colorPrimary"/>
            <RadioButton
                android:id="@+id/gender_other"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="OTHER"
                android:layout_marginLeft="160dp"
                android:textColor="#000000"
                android:buttonTint="@color/colorPrimary"/>
        </RadioGroup>


        <RadioGroup
            android:id="@+id/type_rg"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="TYPE"
                android:textColor="#000000"
                android:textStyle="bold"
                android:textColorHint="@color/colorPrimary" />
            <RadioButton
                android:id="@+id/type_bride"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="BRIDE"
                android:layout_marginLeft="160dp"
                android:textColor="#000000"
                android:buttonTint="@color/colorPrimary"/>
            <RadioButton
                android:id="@+id/type_groom"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginLeft="160dp"
                android:text="GROOM"
                android:textColor="#000000"
                android:buttonTint="@color/colorPrimary"/>
        </RadioGroup>

        <EditText
            android:layout_margin="8dp"
            android:inputType="textEmailAddress"
            android:hint="Enter your email"
            android:textColorHint="#000000"
            android:textColor="#000000"
            android:backgroundTint="@color/colorPrimaryDark"
            android:id="@+id/edit_text_email"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />


        <EditText
            android:layout_margin="8dp"
            android:inputType="textPassword"
            android:hint="Enter your password"
            android:id="@+id/edit_text_password"
            android:textColorHint="#000000"
            android:textColor="#000000"
            android:backgroundTint="@color/colorPrimaryDark"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <EditText
            android:layout_margin="8dp"
            android:inputType="textPassword"
            android:hint="Confirm your password"
            android:id="@+id/edit_text_c_password"
            android:textColorHint="#000000"
            android:textColor="#000000"
            android:backgroundTint="@color/colorPrimaryDark"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <EditText
            android:layout_margin="8dp"
            android:inputType="phone"
            android:hint="Enter Mobile Number"
            android:id="@+id/edit_text_phone"
            android:textColorHint="#000000"
            android:textColor="#000000"
            android:backgroundTint="@color/colorPrimaryDark"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <Button
            android:layout_margin="8dp"
            android:id="@+id/button_register"
            android:text="Register User"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColor="@color/colorAccent"
            android:background="#BAEC407A"/>



        <TextView
            android:textAlignment="center"
            android:id="@+id/text_view_signin"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Already Registered? Sign in here"
            android:textColor="#000000" />

    </LinearLayout>

</RelativeLayout>

Редактировать: Получил проблему. Один из моих xml-файлов дважды имел следующий тег:

1 Ответ

0 голосов
/ 17 октября 2019

Я думаю, что один из ваших Drawable xml содержит <?xml version="1.0" encoding="UTF-8"?> дважды, что вызывает эту проблему. Я сталкивался с этим.

...