引入aar包

將aar包添加到libs中,並在build.gradle中添加一下代碼,就可以引入aar包了

repositories {
    flatDir{
        dir 'libs'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    
    implementation(name:'MyAarName-1.0.0', ext:'aar')
   
   
}

引入aar包重新運行後可能會報錯,有可能是資源衝突等問題

我的出現了“Manifest merger failed with multiple errors, see logs”這個問題

點擊toggle view按鈕可以看到報錯的問題

查看錯誤後發現時icon和theme衝突

在AndroidManifest.xml開頭處加入

xmlns:tools="http://schemas.android.com/tools"

在<application>中加入“  tools:replace="icon,theme"  ”就可以成功運行了

<application
        android:name="p"
        android:theme="@style/AppTheme.NoActionBar"
        tools:replace="icon,theme">

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章