[英]Export Android Library that depends on an App Engine Module
我想導出依賴於App Engine模塊( module B
)的Android庫模塊( module A
)。
在一個帶有應用程序模塊( module C
)的新項目中,我導入了module A
導入了.aar
文件, module B
導入了moduleB/build/libs/moduleB-android-endpoints.jar
。 然后,我在module C
的gradle文件中添加了module A
和module B
作為module C
依賴項。
我可以毫無錯誤地進行編譯,但是當我運行module C
應用程序時,似乎module B
類不在運行時類路徑中。
關於如何解決問題的一些提示?
這是錯誤:
Caused by: java.lang.NoClassDefFoundError: moduleB.backend.registration.Registration$Builder
請執行以下步驟。 它將解決您的問題
1)構建模塊B並復制jar文件。 2)將模塊B jar(moduleB-android-endpoints.jar)添加到模塊A的libs文件夾中。3)打開模塊A app gradle文件,並在依賴目錄中添加以下代碼。
compile files('moduleB-android-endpoints.jar')
4)同步模塊A並進行構建。 它將生成模塊A的aar。5)打開模塊C,並將模塊A生成的aar文件添加到模塊C的libs文件夾中。6)將以下行添加到模塊C應用程序gradle文件中。
dependencies {
compile(name:'module A aar file name', ext:'aar')
}
repositories{
flatDir{
dirs 'libs'
}
}
7)同步和重建模塊C。它將工作
我決定將這些行添加到module C
的gradle文件中:
compile ('com.google.api-client:google-api-client-android:1.17.0-rc') {
exclude module: 'httpclient'
}
compile ('com.google.http-client:google-http-client-gson:1.17.0-rc') {
exclude module: 'httpclient'
}
這是與在module B
內部自動創建的內部Builder類有關的問題。 他們錯過了這些依賴。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.