清单合并失败:属性application @ appComponentFactory ... Android Studio 3.2

时间:2019-01-11 15:39:15

标签: android android-studio kotlin

我正在关注本教程:https://www.youtube.com/watch?v=xtElLuzjA0U

我正在使用Android Studio 3.2.1-每当我实现“实现'me.zhanghai.android.materialprogressbar:library:1.6.1'”时,都会出现此错误:

function GET-mandatory-modules {
    Write-Host "checking availability of necessery modules" -ForegroundColor Green
    #ad module
    if (!(Get-Command Get-ADComputer -ErrorAction SilentlyContinue)) {
        Write-Host "GET-ad-computer command unavailable, installing module AD-powershell" -ForegroundColor yellow
        Get-WindowsFeature |
            where name -like RSAT-AD-PowerShell |
            Install-WindowsFeature
    } else {
        Write-Host "ad-module is avialable, installation is not necessery"
    }
} #end function GET-mandatory-modules

当我第一次学习本教程时,所有内容都已编译,我能够获得进度条,但是当我尝试调试和构建时,它崩溃了。现在,我第二次实现依赖关系会给我同样的错误。

PS-我将其设置为4.4-当前的android

我看过“ https://developer.android.com/topic/libraries/support-library/packages”,当我交叉引用时,似乎已经包含28.0.0了-我不确定从这里开始做什么。

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.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
 Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> 
element at AndroidManifest.xml:5:5-22:19 to override.

需要什么支持?我尝试实现tools:replace ...但是它给了我很多错误。

3 个答案:

答案 0 :(得分:7)

这是因为您的项目具有相同库的不同版本-androidx和pre-androidx。 在android studio工具栏中,转到:Refactor-> Migrate to androidX... -> Migrate

答案 1 :(得分:2)

这两行自动解决了我的依赖冲突

添加  SELECT st.APIStatus AS 'ID' ,st.StatusMessage AS 'Status_Message' ,@VerboseMsg AS 'Developer_Message' ,@DisplayMsg AS 'User_Message' ,st.ReturnCode AS 'Return_Code' , (SELECT @ReturnCode AS ErrorCode, @DisplayMsg AS ErrorMsg FOR JSON PATH) AS [Error] ,[Customer].CustomerID AS 'ID' ,[Customer].FirstName AS 'First_Name' ,[Customer].PaternalLastName AS 'Paternal_Last_Name' ,[Customer].EmailAddress AS 'Email_Address' FROM (SELECT 200 AS APIStatus, 'Success' AS StatusMessage, @ReturnCode AS ReturnCode) st LEFT JOIN (SELECT CustomerID ,FirstName ,PaternalLastName ,EmailAddress ,@ReturnCode AS ReturnCode FROM #Customers ) As [Customer] ON st.ReturnCode = [Customer].ReturnCode -- why? FOR JSON AUTO, ROOT('APIResult') 在您的应用程序android.useAndroidX=true android.enableJetifier=true文件中。

答案 2 :(得分:1)

您需要使用AndroidX或旧的Android支持库。 这就是为什么您遇到这个问题。

1。现有项目: 您需要迁移到AndroidX。
在迁移之前,请备份项目。
要遵循的步骤-
Android Studio => Refactor Menu => Migrate to AndroidX...
它将分析并在底部打开“折射器”窗口。接受更改。

2。新项目: 将这些标志放在您的gradle.properties中。
android.enableJetifier=true android.useAndroidX=true