標籤:add .project 背景 ati height war width 如何 估計
【背景】
之前折騰:
【記錄】Android Studio中匯入OsmAnd並編譯
期間,遇到了編譯警告:
| 12345 |
:OsmAnd-java:compileJava注: E:\crifan\DevRoot\Osmand-master\OsmAnd-java\src\net\osmand\util\GeoPointParserUtil.java使用或覆蓋了已淘汰的 API。注: 有關詳細資料, 請使用 -Xlint:deprecation 重新編譯。注: 某些輸入檔案使用了未經檢查或不安全的操作。注: 有關詳細資料, 請使用 -Xlint:unchecked 重新編譯。 |
【解決過程】
1.之前不知道如何解決。然後也沒影響繼續編譯,所以當時就沒理會。
2.後來看到:
Android Studio系列教程四–Gradle基礎
中的:
| 1234 |
// 移除lint檢查的errorlintOptions { abortOnError false} |
猜測是,build.gradle中有對應的此處,可以添加lint的參數,估計上面說的:
| 12 |
-Xlint:deprecation-Xlint:unchecked |
的參數,或許可以放在這裡。
所以去嘗試一下。
但是在Osmand-java中的build.gradle中並沒有看到那個(android下的)lintOptions
所以,還是去網上搜尋這個問題吧。
3.搜:
android studio Xlint:deprecation
參考:
How to add -Xlint:unchecked to my Android Gradle based project? – Stack Overflow
去加上這個配置:
然後再去編譯看看。
果然沒了警告了:
【總結】
當Android Studio中編譯java方面的代碼,出現類似的警告:
- 有關詳細資料, 請使用 -Xlint:deprecation 重新編譯。
- 有關詳細資料, 請使用 -Xlint:unchecked 重新編譯。
時,去項目對應的build.gradle中添加配置:
| 1234567 |
allprojects { gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" } }} |
即可消除警告。
Android Studio編譯OsmAnd出現警告:GeoPointParserUtil.java使用或覆蓋了已淘汰的 API。有關詳細資料請使用-Xlint:deprecation重新編譯