2017-06-26 43 views
4

我目前正在開發一個即時應用程序,爲此我將我的整體應用程序重新組織爲功能模塊。 一切都正常運行,直到Android Studio中的金絲雀3,但更新至Android Studio中金絲雀4我的項目構建失敗,出現以下錯誤後:Android Studio 3.0加載錯誤加納利4

A problem was found with the configuration of task ':minimoBase:dataBindingExportBuildInfoDebugAndroidTest'. 

> Directory '/Users/nayak.vishal/projectData/minimo_instant_app_project/putica-client-android- 
native/minimoBase/build/intermediates/data-binding-info/androidTest/debug' 
specified for property 'xmlOutFolder' does not exist. 
+0

您是否更改過「build.gradle(applicationName)」中的版本? –

回答

8

下面的過程加工作爲一種變通方法針對此問題:

執行以下的gradle這個命令行

1)gradlew乾淨上建立命令

2)gradlew:的AppModule:assembleDebug

  • here appModule is the name of the app module for building the installable apk
  • the build is successful and the debug apk generated in the output folder can be installed successfully

3)gradlew:instantAppModule:assembleDebug

  • here instantAppModule is the name of the instant app module
  • the build is successful and the instant app apks can be installed and launched via deep link

一旦上述命令行構建是成功的,經由Android Studio中金絲雀4構建也停止投擲生成錯誤。

+0

如何使用gradle命令行? – Rookie

+0

這些鏈接應該有所幫助:) https://docs.gradle.org/0.9-rc-2/userguide/tutorial_gradle_command_line.html https://developer.android.com/studio/build/building-cmdline.html – Vishy

1

更新時間:

只是檢查加納利版本更新後。爲此,請參閱工具欄(File..Edit..View..line)上方的Android Studio版本,其中名稱如「Canary X」.-> X的數字類似3,4,5等。

例如假設更新版本(X)是5。 嘗試(/嘗試)來改變類路徑在的build.gradle(的applicationName)至3.0.0-素α5和同步再次:

dependencies { 
    classpath 'com.android.tools.build:gradle:3.0.0-alpha5' 
} 

就是說更新版本(X): -

dependencies { 
    classpath 'com.android.tools.build:gradle:3.0.0-alphaX' 
} 
+0

感謝您的回覆。是,gradle插件版本已經是gradle:3.0.0-alpha4,並且gradle包裝器屬性中的distributionURL設置爲gradle-4.0-rc-1-all.zip。這是Android Studio在更新Canay 4時自動提示的。所以我不認爲這是構建錯誤的原因。 – Vishy

+0

不正確。更改gradle版本時,我仍然遇到同樣的錯誤 –

1

我有同樣的問題,似乎是在加那利4

012錯誤

現在,作爲一種解決方法,我降級到Android Studio中3.0.0金絲雀3(https://developer.android.com/studio/archive.html)以及降級了Android搖籃插件3.0.0-素α3:

dependencies { 
    classpath 'com.android.tools.build:gradle:3.0.0-alpha3' 
    ... 
} 
+0

Yup!必須做同樣的事情來解決問題 – Vishy

3

在你gradle.properties文件,添加以下行

android.enableAapt2=false 

最近AS3.0的版本切換到使用AAPT2默認。 您可以在gradle.propertіes禁用AAPT2用的代碼上述行fіle,並繼續AS3金絲雀開發4.

+1

此更改沒有幫助 –

5

我得到了類似的錯誤,當我打開data-binding的庫模塊。當我將其關閉並將所有需要data-binding的課程移動到app模塊時,它才起作用。所以我想有一個問題,DataBinding不再適用於Library模塊(Gradle 2.x很好)。

dataBinding { 
    enabled = false 
} 

我使用com.android.tools.build:gradle:3.0.0-alpha5和Android Studio的3.0預覽版Canary5

UPDATE

雖然原來的答覆工作,我真想打開data-binding我的庫模塊上,在這裏我實現了一些基礎類使用綁定技術。我將它們移回library模塊並將kotlin版本升級到最新版本1.1.3-2。突然它也起作用。我不確定哪一個更好,但兩種方式都適合我。

更新2

我使用com.android.tools.build:gradle:3.0.0-alpha9此時科特林1.1.3-2突然的問題再次出現。 現在我認爲問題不是來自Kotlin。我的圖書館模塊變成了dataBiding { enabled=true},但它沒有任何佈局文件。我試圖創建由<layout>標籤包裹假的佈局文件和它的作品

<?xml version="1.0" encoding="utf-8"?> 
<layout> 
    <View xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"/> 
</layout> 
+0

我在AS 3.0 Canary-6面臨同樣的問題。你解決了我的問題。感謝更新。實際上,默認情況下,項目中的數據綁定是正確的。 – Custadian

+0

更改爲1.1.3-2適用於我。 Tks –

3

這是我的問題,當我有沒有任何佈局「基本」功能模塊(所有我的實際佈局在不同的功能)

在基本功能中添加虛擬佈局XML文件(例如base/src/res/layout/dummy.xml)意味着創建了丟失的目錄並編譯了應用程序。

(這是使用com.android.tools.build:gradle:3.0.0-alpha6

+1

這是我的確切問題。感謝您指出。 – tasomaniac

+0

@ pete-harris是對的。您應該至少添加一個佈局,作爲根元素「layout」 - 視圖的數據綁定根元素。因此,如果您沒有配置任何數據綁定佈局,請嘗試創建一個,如下所示: '<?xml version =「1.0」encoding =「utf-8」?> ' – marciowb