android studio匯入module需要注意的點
阿新 • • 發佈:2019-01-08
1.匯入module
File->New->Import Module
2.將自己專案中的
compileSdkVersion 23 buildToolsVersion '25.0.0'minSdkVersion 17 targetSdkVersion 22對應的項拷貝到module中的build.grade替換掉
注意:module的build.grade中minSdkVersion的值只能低於或等於專案的build.grade的值
不然會報以下錯誤:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs
3.新增依賴
第四步新增module選擇剛才匯入的module
4.更改專案的AndroidManifest檔案
新增兩行
xmlns:tools="http://schemas.android.com/tools"
tools:replace="android:icon"tools:replace="android:icon"的值可以是多箇中間用逗號隔開例如:
tools:replace="android:icon,android:theme"沒改的話有如下報錯:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute [email protected] value=(@mipmap/ic_launcher) from AndroidManifest.xml:7:9-43
is also present at [Study_impotModule:FileSelector:unspecified] AndroidManifest.xml:13:9-45 value=(@drawable/ic_launcher).
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.