Hirose
Hirose

Reputation: 105

'tools:replace="android:allowBackup"' to <application> element

I have issue when i add implementation 'com.github.MdFarhanRaja:SearchableSpinner:2.0' warning suggest to me

'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:20:5-123:19 to override.

This is my Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.together">
    <!--
         The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
         Google Maps Android API v2, but you must specify either coarse or fine
         location permissions for the 'MyLocation' functionality.
    -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- 맵 이용하기 위함 -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 다음 지도 -->
    <uses-permission android:name="android.permission.INTERNET" /> <!-- 대략적인 위치 참조 권한 -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 정확한 위치 참조 권한 -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
        android:allowBackup="false"
        android:appComponentFactory="whateverString"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        tools:replace="android:appComponentFactory">

but when i change

 tools:replace="android:appComponentFactory"

this to

'tools:replace="android:allowBackup"

with this the new error show and suggetion to me

Manifest merger failed : Attribute application@appComponentFactory value=(whateverString) from AndroidManifest.xml:22:9-53
    is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:20:5-123:19 to override.

That suggest change android:appComponentFactory this

What should i do if i want to implementation it?

This is my Module: app + I add my build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.blogapp"
        minSdkVersion 21
        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'

        }
    }

    compileOptions {

        sourceCompatibility JavaVersion.VERSION_1_8

        targetCompatibility JavaVersion.VERSION_1_8

    }
}

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:animated-vector-drawable:28.0.0'//
    implementation 'com.android.support:exifinterface:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3' //있고 ㅇㅇ


    //Expandable 프래그먼트 goodbyepet selectmenu
    implementation 'com.thoughtbot:expandablerecyclerview:1.3'
    implementation 'com.thoughtbot:expandablecheckrecyclerview:1.4'


    //유튜브 강의 3 추가함
    //1장에서 설정한거 추가


    //1장에서 설정한거 추가
    implementation 'com.jakewharton:butterknife:8.8.1'
    //유튜브 강의 3 추가함


    // firebase core

    implementation 'com.google.firebase:firebase-core:16.0.9'

    // firebase auth
    implementation 'com.google.firebase:firebase-auth:17.0.0'

    // firebase storage
    implementation 'com.google.firebase:firebase-storage:17.0.0'

    // firebase realtime database
    implementation 'com.google.firebase:firebase-database:17.0.0'

    implementation "com.wdullaer:materialdatetimepicker:3.6.4"


    implementation 'com.android.support:support-v13:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'

    //photo control
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'

    // card view
    implementation 'com.android.support:cardview-v7:28.0.0'

    // swipe cards for petching
    implementation 'com.lorentzos.swipecards:library:1.0.9'

    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    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'  //있고 ㅇㅇ

    // Design library for Coordinator Layout and Toolbars
    implementation 'com.android.support:design:28.0.0'

    // circle design
    implementation 'de.hdodenhof:circleimageview:3.0.0'

    // rectangle design
    implementation 'com.github.siyamed:android-shape-imageview:0.9.3@aar'

    // bumptech/glide
    implementation 'com.github.bumptech.glide:glide:4.9.0'

    //picaso/glide
    implementation 'com.squareup.picasso:picasso:2.71828'

    // Edit Text
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'

    // lombok 사용
    compileOnly 'org.projectlombok:lombok:1.18.8'
    annotationProcessor 'org.projectlombok:lombok:1.18.8'
    implementation 'com.android.support:gridlayout-v7:28.0.0'

    // User Map
    implementation 'com.android.support:appcompat-v7:28.0.0'

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    implementation 'com.google.android.gms:play-services-maps:16.1.0'

    implementation 'com.google.android.gms:play-services-location:16.0.0'

    implementation 'com.google.android.gms:play-services-places:16.1.0'

    implementation 'noman.placesapi:placesAPI:1.1.3'

    implementation 'com.thoughtbot:expandablecheckrecyclerview:1.4'


    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 'org.jetbrains:annotations-java5:15.0'


    //Calendar

    implementation 'joda-time:joda-time:2.10.1'


    // LifeCycle online or offline 여부 판별
    implementation "android.arch.lifecycle:extensions:1.1.1"

    // retrofit2 통신 라이브러리
    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    implementation 'androidx.annotation:annotation:1.1.0'

    //calendar view
    implementation 'com.github.prolificinteractive:material-calendarview:1.5.0'


    // Searchable Spinner



}

apply plugin: 'com.google.gms.google-services'

This is my projed build

// 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'
        classpath 'com.google.gms:google-services:4.2.0'
        // radio button
        classpath 'lib.kingja.switchbutton:switchbutton:1.1.8'
        classpath 'com.android.support:appcompat-v7:28.0.0'
        classpath 'com.google.android.gms:play-services-maps:17.0.0'

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

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

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



Upvotes: 0

Views: 7874

Answers (2)

user13642000
user13642000

Reputation: 21

After android:allowBackup="false" add tools:replace="android:allowBackup". use this code in mainfest file do close this issue.

Upvotes: 2

Zohaib Amir
Zohaib Amir

Reputation: 3562

As mentioned in comments, you are using a third party library that depends on support library and you are using AndroidX in your project. This can be fixed using Jetifier:

Go to your gradle.properties file and add this line:

android.enableJetifier=true

android.enableJetifier: When set to true, this flag indicates that you want to have tool support (from the Android Gradle plugin) to automatically convert existing third-party libraries as if they were written for AndroidX. If the flag is absent, Android Studio behaves as if the flag were set to false.

If this still causes error, please use Migrate to AndroidX from Refactor menu, it should automatically fix this.

enter image description here

Upvotes: 0

Related Questions