skip to Main Content

I’m just creating a simple scratch card app. But while launching, I got these errors,

Task :app:processDebugMainManifest FAILED
[com.android.support:animated-vector-drawable:28.0.0] C:UsersSibam.gradlecachestransforms-2files-2.1e9624393a49dd94b2ca40a9ffdf35a3eanimated-vector-drawable-28.0.0AndroidManifest.xml Warning:
    Package name 'android.support.graphics.drawable' used in: com.android.support:animated-vector-drawable:28.0.0, com.android.support:support-vector-drawable:28.0.0.
[androidx.versionedparcelable:versionedparcelable:1.1.1] C:UsersSibam.gradlecachestransforms-2files-2.19c1a19876166723a3f4a522f5e580c9eversionedparcelable-1.1.1AndroidManifest.xml Warning:
    Package name 'androidx.versionedparcelable' used in: androidx.versionedparcelable:versionedparcelable:1.1.1, com.android.support:versionedparcelable:28.0.0.
D:LuteraaScratchCardappsrcmainAndroidManifest.xml:24:18-86 Error:
    Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.5.0] AndroidManifest.xml:24:18-86
    is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed with multiple errors, see logs

My manifest code,

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

    <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/Theme.LuteraaScratchCard">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

Build.gradle(project),

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.2.2"

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

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://jitpack.io"}
        jcenter() // Warning: this repository is going to shut down soon
    }
}

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

Build.gradle(app),

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.luteraa.luteraascratchcard"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'com.github.AnupKumarPanwar:ScratchView:1.3'

    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

XML,

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
    tools:context=".MainActivity">

    <androidx.cardview.widget.CardView
        android:layout_width="300dp"
        android:layout_height="300dp"
        android:layout_marginEnd="1dp"
        android:layout_marginStart="1dp"
        app:cardCornerRadius="10dp"
        app:cardElevation="10dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" >

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

            <ImageView
                android:id="@+id/imageView"
                android:layout_width="150dp"
                android:layout_height="150dp"
                android:layout_gravity="center"
                android:layout_margin="20dp"
                tools:srcCompat="@tools:sample/backgrounds/scenic" />

            <TextView
                android:id="@+id/textView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:textColor="@color/black"
                android:textSize="25sp"
                android:textStyle="bold"
                android:text="TextView" />
        </LinearLayout>

        <com.anupkumarpanwar.scratchview.ScratchView
            android:id="@+id/scratchView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:overlay_image="@drawable/ic_scratch_pattern"
            app:overlay_width="300dp"
            app:overlay_height="300dp"/>

    </androidx.cardview.widget.CardView>

</androidx.constraintlayout.widget.ConstraintLayout>

Java,

package com.luteraa.luteraascratchcard;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.widget.TextView;

import com.anupkumarpanwar.scratchview.ScratchView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ScratchView scratchView = findViewById(R.id.scratchView);
        TextView textView = findViewById(R.id.textView);

        scratchView.setRevealListener(new ScratchView.IRevealListener() {
            @SuppressLint("SetTextI18n")
            @Override
            public void onRevealed(ScratchView scratchView) {
                int upperBound = 15;
                int lowerBound = 5;
                int number = lowerBound + (int)(Math.random() * ((upperBound - lowerBound) + 1));
                textView.setText("You have won /n" + number);
            }

            @Override
            public void onRevealPercentChangedListener(ScratchView scratchView, float percent) {

            }
        });
    }
}

2

Answers


  1. Please just try to verify the manifest and xml file that is any path given like image file which is not existing in resource folder or permission or os version which not matching with any library you are using.

    Login or Signup to reply.
  2. from this

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
            package="androidx.vectordrawable">
    

    its should be like this

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
            package="androidx.vectordrawable-animated:1.0.0">
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search