這篇文章主要介紹Android Studio3.0.1有哪些需要注意的地方,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
(一)關(guān)于注解
Error:Execution failed for task ':Framework:javaPreCompileDebug'.
Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.
- butterknife-7.0.1.jar (butterknife-7.0.1.jar)
Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future.
See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.
Android Studio官網(wǎng)的說明如下:
Use the annotation processor dependency configuration
一開始我是先找到了解決方法,后面才看到上面的鏈接。先說一下解決方法。在build.gradle 的defaultConfig 中添加下列內(nèi)容:
apply plugin: 'com.android.application' android { ... defaultConfig { ... //大兄弟,這邊~ javaCompileOptions { annotationProcessorOptions { includeCompileClasspath true } } } }
(二)關(guān)于渠道
Error:All flavors must now belong to a named flavor dimension.Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html
所有的flavors都必須屬于同一個(gè)風(fēng)格。官網(wǎng)中文解釋:組合多個(gè)產(chǎn)品風(fēng)味
解決方法就是在build.gradle中添加相應(yīng)的標(biāo)志的內(nèi)容。
flavorDimensions("vas", "normal") //介個(gè) productFlavors { vas { dimension 'vas' buildConfigField "boolean", "ENABL_VAS", "true" dimension "vas" //介個(gè) } normal { dimension 'normal' buildConfigField "boolean", "ENABL_VAS", "false" dimension "normal" //還有介個(gè) } }
(三)關(guān)于Sugar
3.0Android: Sugar ORM No Such Table Exception
項(xiàng)目中用到Sugar,在3.0AS中老是提示找不到表。其實(shí)解決方法很簡單,而且瀏覽的網(wǎng)站也老早就說了該如何處理,但因?yàn)槲衣┑袅岁P(guān)鍵的點(diǎn),所以老是沒成功。
instant run莫勾選
最后!卸載設(shè)備上的舊應(yīng)用,一定要卸載!然后重新運(yùn)行新的應(yīng)用就OK了。
(四)關(guān)于Manifest merger
Execution failed for task ':AppMain:processVasNormalDebugManifest'. Manifest merger failed with multiple errors, see logs
這是我第一次知道原來Manifest還有merge沖突的情況出現(xiàn)。有趣有趣。
項(xiàng)目目錄
我的項(xiàng)目中有一個(gè)application和一個(gè)library,這兩個(gè)module都有自己的manifest。原來as最后會(huì)幫我們將兩個(gè)manifest合并起來,所以當(dāng)二者設(shè)置的內(nèi)容不一致,就會(huì)起沖突,merge失敗。原理就是這樣了。對比一下兩個(gè)manifest中有什么值是大不同的,修改一下就好了。那要怎么看合并的結(jié)果是怎么樣的呢?
比如我打開AppMain的manifest,選擇下面的Merged Manifest 模式,就可以看到最終合并結(jié)果了。
AppMain的manifest
我記得自己的情況是:AppMain的manifest我設(shè)置android:allowBackup="false",然后FramewFramework的manifest為android:allowBackup="true",然后改成都為false就好了。大家要看自己的實(shí)際情況是什么,再做相應(yīng)的修改。
以上是“Android Studio3.0.1有哪些需要注意的地方”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
本文題目:AndroidStudio3.0.1有哪些需要注意的地方-創(chuàng)新互聯(lián)
當(dāng)前地址:http://chinadenli.net/article38/jjesp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信公眾號、網(wǎng)站改版、外貿(mào)建站、服務(wù)器托管、定制網(wǎng)站、全網(wǎng)營銷推廣
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容