剛剛在寫自己的應用后臺管理APP羊异,在設計界面的時候想到可以用CardView去做效果,于是就開始從項目管理里面去依賴读慎,然后悲劇發(fā)生了。
1槐雾,報錯日志:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.0-alpha1) from [com.android.support:cardview-v7:26.0.0-alpha1] AndroidManifest.xml:24:9-38
is also present at [com.android.support:design:25.3.1] AndroidManifest.xml:27:9-31 value=(25.3.1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:22:5-24:41 to override.
思考:
大概意思是CardView中能在這個25.3.1的版本里面使用夭委。
2,查找原因:
在搜索引擎上面飛速搜索了一下募强,發(fā)現(xiàn)沒有案例說這事株灸,難道問題太基礎了?
看了自己的配置文件:
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.jcodecraeer:xrecyclerview:1.3.2'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0-beta4'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'io.reactivex:rxjava:1.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
看了語法并沒有錯擎值,也確實可以依賴進來慌烧。
然后仔細思考了一下,會不會是要跟support包一致才可以幅恋。
3杏死,解決問題
于是馬上行動:
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
//compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:cardview-v7:25.3.1'
略
Sync Now
編譯通過。
4捆交,總結(jié):
所以還真有必須基于support包來依賴的官方包淑翼。
漲知識了。