簡體   English   中英

如何將源集添加到 android 項目

[英]How to add source set to android project

在我的 android 項目中,我想添加一個額外的sourceSet除了默認的 android 源集(主要,調試...)

在我的build.gradle文件中,我嘗試了以下操作:

android {
...
    sourceSet {
        create("shuttle")
    }
....
}

不幸的是,當我同步/構建項目時出現此錯誤ERROR: The SourceSet 'shuttle' is not recognized by the Android Gradle Plugin. Perhaps you misspelled something? ERROR: The SourceSet 'shuttle' is not recognized by the Android Gradle Plugin. Perhaps you misspelled something?

任何想法如何創建將出現在src/{sourceSetName}目錄下的 android 源集,就像我看到src/main的方式一樣?

謝謝。

Android 不再允許您定義自定義源集。 默認源集是: maindebugrelease ,如果你真的想要另一個,你可以添加一個構建類型或風格,android 然后為其創建一個隨附的源集。
另請參閱我的其他答案: https://stackoverflow.com/a/73231777/3968618
還有別人的例子: https://stackoverflow.com/a/61810433/3968618

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM