Android Studio / IDEA kotlin 顯示 var 真實(shí)類(lèi)型操作
File —> Settings —> Editor —> Inlay Hints —> Kotlin
勾選
Show local variable type hints
啟用前
啟用后
補(bǔ)充知識(shí):Android Studio 編譯: Program type already present: XXX 解決方案
情況1:個(gè)例
build.gradle 中
dependencies { classpath ’com.android.tools.build:gradle:3.1.1’ // }
改成
dependencies { //目前最新版【2018年05月15日】 classpath ’com.android.tools.build:gradle:3.1.2’ // }
情況2:確實(shí)是依賴(lài)沖突
Error: Program type already present: android.support.v4.app.xxx
例子:
引入以下依賴(lài)報(bào)該錯(cuò)誤
//Paho Android Service implementation ’org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2’ implementation ’org.eclipse.paho:org.eclipse.paho.android.service:1.0.2’
執(zhí)行命令:
gradlew -q app:dependencies
排查 support-v4 出現(xiàn)的依賴(lài)關(guān)系中 發(fā)現(xiàn) org.eclipse.paho:org.eclipse.paho.android.service:1.0.2
依賴(lài)了 com.google.android:support-v4 注意不是 com.android.support:support-v4 ?。。?/p>
坑:
//剛開(kāi)始下意識(shí)去寫(xiě)了個(gè)排除,發(fā)現(xiàn)沒(méi)有用。。。,原因就是它用 com.google.android:support-v4 不是 com.android.support implementation(’org.eclipse.paho:org.eclipse.paho.android.service:1.0.2’){ exclude group: ’com.android.support’, module: ’support-v4’ }
總結(jié):
找到依賴(lài)的問(wèn)題根源后進(jìn)行排除,按提示報(bào)錯(cuò)的來(lái)靈活處理沖突問(wèn)題!
排除方式1:
configurations { all*.exclude group: ’com.google.android’, module: ’support-v4’ //或者粗暴點(diǎn),就沒(méi)有上面的坑了 all*.exclude module: ’support-v4’}dependencies {... implementation ’org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2’ implementation ’org.eclipse.paho:org.eclipse.paho.android.service:1.0.2’...}
排除方式2:
implementation ’org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2’ implementation(’org.eclipse.paho:org.eclipse.paho.android.service:1.0.2’) { exclude(group: ’com.google.android’, module: ’support-v4’) }/* 或者粗暴點(diǎn),就沒(méi)有上面的坑了implementation(’org.eclipse.paho:org.eclipse.paho.android.service:1.0.2’) { exclude module: ’support-v4’ } */
情況3:
com.android.support:xxx 等官方依賴(lài)包 v4 v7 v13 等版本號(hào)保持一致 比如 27.1.1
以上這篇Android Studio / IDEA kotlin 顯示 var 真實(shí)類(lèi)型操作就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. bootstrap select2 動(dòng)態(tài)從后臺(tái)Ajax動(dòng)態(tài)獲取數(shù)據(jù)的代碼2. js select支持手動(dòng)輸入功能實(shí)現(xiàn)代碼3. ASP常用日期格式化函數(shù) FormatDate()4. 網(wǎng)頁(yè)中img圖片使用css實(shí)現(xiàn)等比例自動(dòng)縮放不變形(代碼已測(cè)試)5. html中的form不提交(排除)某些input 原創(chuàng)6. CSS3中Transition屬性詳解以及示例分享7. vue使用moment如何將時(shí)間戳轉(zhuǎn)為標(biāo)準(zhǔn)日期時(shí)間格式8. python 如何在 Matplotlib 中繪制垂直線9. jsp文件下載功能實(shí)現(xiàn)代碼10. 開(kāi)發(fā)效率翻倍的Web API使用技巧
