這篇文章主要介紹Android Studio3.0.1有哪些需要注意的地方,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
(一)關于注解
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官網的說明如下:
Use the annotation processor dependency configuration
一開始我是先找到了解決方法,后面才看到上面的鏈接。先說一下解決方法。在build.gradle 的defaultConfig 中添加下列內容:
apply plugin: 'com.android.application' android { ... defaultConfig { ... //大兄弟,這邊~ javaCompileOptions { annotationProcessorOptions { includeCompileClasspath true } } } }
(二)關于渠道
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都必須屬于同一個風格。官網中文解釋:組合多個產品風味
解決方法就是在build.gradle中添加相應的標志的內容。
flavorDimensions("vas", "normal") //介個 productFlavors { vas { dimension 'vas' buildConfigField "boolean", "ENABL_VAS", "true" dimension "vas" //介個 } normal { dimension 'normal' buildConfigField "boolean", "ENABL_VAS", "false" dimension "normal" //還有介個 } }
(三)關于Sugar
3.0Android: Sugar ORM No Such Table Exception
項目中用到Sugar,在3.0AS中老是提示找不到表。其實解決方法很簡單,而且瀏覽的網站也老早就說了該如何處理,但因為我漏掉了關鍵的點,所以老是沒成功。
instant run莫勾選
最后!卸載設備上的舊應用,一定要卸載!然后重新運行新的應用就OK了。
(四)關于Manifest merger
Execution failed for task ':AppMain:processVasNormalDebugManifest'. Manifest merger failed with multiple errors, see logs
這是我第一次知道原來Manifest還有merge沖突的情況出現。有趣有趣。
項目目錄
我的項目中有一個application和一個library,這兩個module都有自己的manifest。原來as最后會幫我們將兩個manifest合并起來,所以當二者設置的內容不一致,就會起沖突,merge失敗。原理就是這樣了。對比一下兩個manifest中有什么值是大不同的,修改一下就好了。那要怎么看合并的結果是怎么樣的呢?
比如我打開AppMain的manifest,選擇下面的Merged Manifest 模式,就可以看到最終合并結果了。
AppMain的manifest
我記得自己的情況是:AppMain的manifest我設置android:allowBackup="false",然后FramewFramework的manifest為android:allowBackup="true",然后改成都為false就好了。大家要看自己的實際情況是什么,再做相應的修改。
以上是“Android Studio3.0.1有哪些需要注意的地方”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。