清单合并失败(AppIntro)

时间:2019-03-17 19:12:25

标签: java android-manifest

我在运行该应用时出现此错误:

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:6:5-30:19 to override.

当我在清单tools:replace="android:appComponentFactory"元素中添加<application>时,现在出现此错误:

Manifest merger failed with multiple errors, see logs

我不知道这意味着什么。.我只是想在我的应用程序中提供一些介绍,以便首次为我们的应用程序用户提供指南。

我有以下依赖性:

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'
    implementation 'com.android.support:design:28.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'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.github.razerdp:AnimatedPieView:1.2.4'
    implementation 'org.jetbrains:annotations-java5:15.0'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    debugImplementation 'com.amitshekhar.android:debug-db:1.0.5'
    implementation 'com.github.AppIntro:AppIntro:v5.1.0'
}

这些清单代码:

<?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.admin.test2">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/pblauncher"
        android:label="Pocket Budget"
        android:roundIcon="@mipmap/pblauncher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:ignore="GoogleAppIndexingWarning">

        <activity android:name=".MainActivity"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".ScreenOne"
            android:windowSoftInputMode="adjustNothing"
            android:screenOrientation="portrait">
        </activity>
        <activity android:name=".Intro"
            android:screenOrientation="portrait"/>

    </application>

</manifest>

我不知道这些错误是什么 和 我是我们应用程序的首次用户使用此Intro类:

package com.example.admin.test2;

import android.os.Bundle;
import android.widget.Toast;

import com.github.paolorotolo.appintro.AppIntro;
import com.github.paolorotolo.appintro.AppIntroFragment;
import com.github.paolorotolo.appintro.model.SliderPage;

import androidx.fragment.app.Fragment;

public class Intro extends AppIntro {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        SliderPage sliderPage = new SliderPage();
        sliderPage.setTitle("Track your expenses");
        sliderPage.setDescription("You can check the list of your expenses along with the residual balance in the home screen");
        sliderPage.setImageDrawable(R.drawable.home_screen);
        sliderPage.setBgColor(getResources().getColor(R.color.pastelGreen));
        addSlide(AppIntroFragment.newInstance(sliderPage));

        SliderPage sliderPage2 = new SliderPage();
        sliderPage2.setTitle("Change current date period");
        sliderPage2.setDescription("You can change the current date period categorized to Daily, Monthly, Yearly, and All.");
        sliderPage2.setImageDrawable(R.drawable.period2);
        sliderPage2.setBgColor(getResources().getColor(R.color.pastelGreen));
        addSlide(AppIntroFragment.newInstance(sliderPage2));

        SliderPage sliderPage3 = new SliderPage();
        sliderPage3.setTitle("Add your income");
        sliderPage3.setDescription("This is where you settle the amount of money needed in order to pay the expenses or how much money you have.");
        sliderPage3.setImageDrawable(R.drawable.income_tab);
        sliderPage3.setBgColor(getResources().getColor(R.color.pastelDarkbBlue));
        addSlide(AppIntroFragment.newInstance(sliderPage3));

        SliderPage sliderPage4 = new SliderPage();
        sliderPage4.setTitle("Add your expenses");
        sliderPage4.setDescription("This is where you put your expenses together with some details such as the amount, date, and others.");
        sliderPage4.setImageDrawable(R.drawable.expense2);
        sliderPage4.setBgColor(getResources().getColor(R.color.pastelRed));
        addSlide(AppIntroFragment.newInstance(sliderPage4));

        SliderPage sliderPage5 = new SliderPage();
        sliderPage5.setTitle("See the distribution of expenses");
        sliderPage5.setDescription("This is where the segments of the total expenses are found. It is shown in a pie chart form to easily recognize the difference of each expense.");
        sliderPage5.setImageDrawable(R.drawable.distribution2);
        sliderPage5.setBgColor(getResources().getColor(R.color.pastelPink));
        addSlide(AppIntroFragment.newInstance(sliderPage5));

        SliderPage sliderPage6 = new SliderPage();
        sliderPage6.setTitle("Record savings");
        sliderPage6.setDescription("You can check the total balance of your money and verify the savings that you will gain depending on the expenses that were added.");
        sliderPage6.setImageDrawable(R.drawable.savings2);
        sliderPage6.setBgColor(getResources().getColor(R.color.pastelGreen));
        addSlide(AppIntroFragment.newInstance(sliderPage6));

    }
    @Override
    public void onDonePressed(Fragment currentFragment) {
        super.onDonePressed(currentFragment);
        Toast.makeText(Intro.this, "Pakyu tong introng to!", Toast.LENGTH_SHORT).show();
    }
}

1 个答案:

答案 0 :(得分:0)

第1步:在gradle.properties中添加以下代码段

android.enableJetifier=true 
android.useAndroidX=true

第2步:在dependencies-Module:app文件的build.gradle部分中的以下代码段中添加

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha04'

希望这会对您有所帮助。