Как исправить ошибку «Выполнение не удалось» для задачи ': app: mergeDebugResources' - PullRequest
0 голосов
/ 29 мая 2019

Я обновился до Android 3.4, и я работаю над приложением TO-DO, и когда я хочу его запустить, но оно выдает мне эту ошибку:

Executing tasks: [:app:assembleDebug]

> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:generateDebugSources UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:mainApkListPersistenceDebug UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources FAILED

Execution failed for task ':app:mergeDebugResources'
>1 exception was raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  C:\Users\CHARAN\Desktop\Android Development\BPTODO\app\src\main\res\drawable-v24\ic_launcher_foreground.xml:11: error: not well-formed (invalid token).
  C:\Users\CHARAN\Desktop\Android Development\BPTODO\app\src\main\res\drawable-v24\ic_launcher_foreground.xml: error: file failed to compile.
* 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 35s
8 actionable tasks: 1 executed, 7 up-to-date

Я пытался 1. очистить и восстановить 2. сделать недействительными кэши и перезапустить 3. изменение зависимостей gradle и это то, что предложила андроид студия 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. И даже попробовал это

Gradle (проект)

// 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.4.1'

        // 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
}

Gradle (приложение)


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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
}

Activity_main.xml

<LinearLayout
    android:orientation="vertical"
    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="#F4F4F4"
    tools:context=".MainActivity">


    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:background="#1eea40"
        android:layout_height="198dp">

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

            <LinearLayout
                android:layout_marginLeft="16dp"
                android:orientation="vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

                <TextView
                    android:id="@+id/titlepage"
                    android:layout_marginTop="20dp"
                    android:textSize="32sp"
                    android:textColor="#FFF"
                    android:text="TO DO's"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />

                <TextView
                    android:id="@+id/subtitlepage"
                    android:textSize="18sp"
                    android:textColor="#4A4E6A"
                    android:layout_marginTop="8dp"
                    android:text="Finish Them Quickly Today"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />

            </LinearLayout>

            <Button
                android:id="@+id/btnAddNew"
                android:layout_width="99dp"
                android:layout_height="52dp"
                android:layout_marginLeft="60dp"
                android:layout_marginTop="35dp"
                android:background="@drawable/bgbtnnew"
                android:text="+"
                android:textAlignment="center"
                android:textColor="#FFF"
                android:textSize="38sp" />

        </LinearLayout>

        <View
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:background="#131E69"
            android:layout_height="1dp" />

    </LinearLayout>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/ourdoes"
        android:layout_width="match_parent"
        android:layout_marginTop="-60dp"
        android:layout_marginRight="16dp"
        android:layout_marginLeft="16dp"
        android:layout_height="wrap_content">

    </android.support.v7.widget.RecyclerView>

    <TextView
        android:id="@+id/endpage"
        android:textSize="16sp"
        android:textColor="#9A9A9A"
        android:layout_marginTop="20dp"
        android:text="No More Does"
        android:textAlignment="center"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
</LinearLayout>

«Я ожидаю, что результат будет работать гладко, пожалуйста, помогите» Заранее спасибо

Ответы [ 2 ]

0 голосов
/ 29 мая 2019

Проверьте файл: res\drawable-v24\ic_launcher_foreground.xml

Ваша ошибка говорит о том, что она неправильно сформирована.Это означает, что есть некоторая синтаксическая ошибка или опечатка или пропущенные скобки или, возможно, нет изображений.

0 голосов
/ 29 мая 2019

Сборка> Чистый проект

Или

./gradlew clean build

Или

В разделе build.gradle отдельных приложений android {} вставить:

aaptOptions {  
    cruncherEnabled = false  
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...