從前聽大神同事強老師說IntelliJ IDEA 功能強大,是Jet Brains 公司開發商業IDE(集成開發環境),同時支持Java, Scala 和Groovy。商業IDE即IntelliJ 是一款收費的IDE,當然了其實也有免費的社區版本,但是很多功能都被閹割了。IntelliJ 除了支持Android項目開發,還可以搭建java web 開發環境,功能比AS更強大。
阿拉最近重裝了電腦,想著干脆也裝個IntelliJ 吧,但是另一個同事說Intellij與AS會沖突。一開始我覺得是他太嫩,不愛折騰。后面因為as3.0自身有一些新的坑,Intellij我暫時沒弄成功,終于是先放下它,晚點再來對付。畢竟還是要上班工作的,但我是打不死的程序媛。
(一)關于注解
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填坑筆記,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VEVB武林網網站的支持!
新聞熱點
疑難解答