Android Studio編譯OsmAnd出現警告:GeoPointParserUtil.java使用或覆蓋了已淘汰的 API。有關詳細資料請使用-Xlint:deprecation重新編譯

來源:互聯網
上載者:User

標籤: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重新編譯

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.