2
我有一個gradle文件內有多個依賴關係,我引入了一個新的構建變體調用「apple」。但我不想複製和粘貼如下。Gradle配置繼承
dependencies {
debugCompile "com.android:libraryA:1.0.0"
debugCompile "com.android:libraryB:1.0.0"
debugCompile "com.android:libraryC:1.0.0"
appleCompile "com.android:libraryA:1.0.0"
appleCompile "com.android:libraryB:1.0.0"
appleCompile "com.android:libraryC:1.0.0"
}
有沒有一種方法,我可以說appleCompile
取決於debugCompile
?
你是怎麼定義'apple'的?如果你[使用'initWith()'](https://developer.android.com/studio/build/build-variants.html#build-types),可能會複製依賴關係,如果在定義之前定義了依賴關係構建類型(即,'dependencies {}'出現在'android {}'之前)。我沒有嘗試過,所以我不知道它是否有效。 – CommonsWare
@CommonsWare我正在使用apple.initwith(調試),我也嘗試過蘋果{initWith調試}以及它只複製了構建變體配置,而不是依賴 –