Ошибка слияния манифеста (AppIntro) - PullRequest
0 голосов
/ 17 марта 2019

Когда я запускаю приложение, у меня появляется эта ошибка:

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>

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

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 голосов
/ 18 марта 2019

Шаг 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'

Надеюсь, это поможет вам.

...