Ionic生成的android项目中,如何引用第三方项目作为library?
本文介绍了Ionic生成的android项目中,如何引用第三方项目作为library?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
我有一个使用ionic生成的android项目。使用android studio打开后,引用了一些第三方项目。项目结构如下:
其中,livenesslib、ocridcardlibrary...
等都是引用的第三方项目。之后修改project.properties中内容如下:
target=android-25
android.library.reference.1=CordovaLib
android.library.reference.2=livenesslib
android.library.reference.3=ocridcardlibrary
android.library.reference.4=Ocr_BankCard_Library
android.library.reference.5=ocrnamecardLibrary
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.gradle.include.1=cordova-plugin-crosswalk-webview/androidmid-xwalk.gradle
在使用ionic build android
试图build时,报出以下错误:
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugApk'.
> Project : declares a dependency from configuration 'debugCompile' to configuration 'debug' which is not declared in the descriptor for project :livenesslib
.
如图:
对ionic实在不熟,头疼了一天都没能弄好,请问应该如何解决?先行谢过!
解决方案
解决了,在所有library项目的build.gradle中添加语句publishNonDefault true即可。参考CordovaLib的build.gradle
这篇关于Ionic生成的android项目中,如何引用第三方项目作为library?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文