您的位置:首页 > 移动开发 > Android开发

注: 某些输入文件使用或覆盖了已过时的 API。 android studio

2016-07-24 11:15 513 查看
参考:http://blog.csdn.net/u012416928/article/details/47356887

使用android studio打包应用程序出现如下错误:

注: 某些输入文件使用或覆盖了已过时的 API。 

注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 

注: 某些输入文件使用了未经检查或不安全的操作。 

注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。

编译完之后就告诉我这寥寥无几的错误提示,让我情何以堪,于是google了下得到的答案:

地址

我把这段代码粘贴过来了:
<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">allprojects {
gradle<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.projectsEvaluated</span> {
tasks<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.withType</span>(JavaCompile) {
options<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.compilerArgs</span> << <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"-Xlint:unchecked"</span> << <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"-Xlint:deprecation"</span>
}
}
}
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li></ul>


重新编译得到如下错误提示:
<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">sers/guoyoujin/AndroidStudioProjects/gz/app/src/main/java/<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">com</span>/guoyoujin/gz/gz/net/HttpConnect<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.java</span>:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">83</span>: 警告: [deprecation] org<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.apache</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.http</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.params</span>中的BasicHttpParams已过时
BasicHttpParams httpParams = new BasicHttpParams()<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
^
/Users/guoyoujin/AndroidStudioProjects/gz/app/src/main/java/<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">com</span>/guoyoujin/gz/gz/net/HttpConnect<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.java</span>:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">85</span>: 警告: [deprecation] org<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.apache</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.http</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.conn</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.params</span>中的ConnManagerParams已过时
ConnManagerParams<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.setTimeout</span>(httpParams, Globe<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.TIMEOUT</span>_SOCKET)<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
^
/Users/guoyoujin/AndroidStudioProjects/gz/app/src/main/java/<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">com</span>/guoyoujin/gz/gz/net/HttpConnect<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.java</span>:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">86</span>: 警告: [deprecation] org<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.apache</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.http</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.conn</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.params</span>中的ConnPerRouteBean已过时
ConnManagerParams<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.setMaxConnectionsPerRoute</span>(httpParams, new ConnPerRouteBean(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">15</span>))<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">;</span>
^
注: 某些输入文件还使用或覆盖了已过时的 API。
<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">100</span> 个警告</code><code class="hljs avrasm has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li></ul>


好吧,果然错误提示变的非常详细,接下来就可以去修改这些警告了,如果你有时间的话

------------------------------------------------------------------------------------------------------------------------------------
在项目build.gradle中添加:显示出详细错误位置



allprojects { gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" } }}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: