我正在学习如何使用cordova构建应用程序,而且我目前能够通过谷歌浏览器模拟移动屏幕。我试图在android平台上测试它,这需要使用Android studio(下载3.0稳定版)。导入项目后, Gradle项目同步失败,似乎解决了CordovaLib的某些依赖项问题。见下图
我已经在这里发过几篇帖子,但仍然无法找到解决方案,或者我可能会错过这一点,因为这是我第一次学习它。以下是
的设置build.gradle(Module:CordovaLib)
和build.gradle(Module:android)
请问如何解决问题并在模拟器中运行我的应用程序?
答案 0 :(得分:9)
是migration的典型错误,请阅读“本地模块的迁移依赖关系配置”一节':
您应该按如下方式配置依赖项:
dependencies {
// This is the old method and no longer works for local
// library modules:
// debugImplementation project(path: ':library', configuration: 'debug')
// releaseImplementation project(path: ':library', configuration: 'release')
// Instead, simply use the following to take advantage of
// variant-aware dependency resolution. You can learn more about
// the 'implementation' configuration in the section about
// new dependency configurations.
implementation project(':library')
// You can, however, keep using variant-specific configurations when
// targeting external dependencies. The following line adds 'app-magic'
// as a dependency to only the "debug" version of your module.
debugImplementation 'com.example.android:app-magic:12.3'
}
答案 1 :(得分:3)
来自trocchietto的解决方案是正确的。 请记住,您正在使用" CordovaLib"没有"图书馆"你只需要这样改变。
dependencies {
// This is the old method and no longer works for local
// compile fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
// debugCompile(project(path: "CordovaLib", configuration: "debug"))
//releaseCompile(project(path: "CordovaLib", configuration: "release"))
// SUB-PROJECT DEPENDENCIES END
// Instead, simply use the following to take advantage of
// variant-aware dependency resolution. You can learn more about
// the 'implementation' configuration in the section about
// new dependency configurations.
implementation project(':CordovaLib')
// You can, however, keep using variant-specific configurations when
// targeting external dependencies. The following line adds 'app-magic'
// as a dependency to only the "debug" version of your module.
//debugImplementation 'com.example.android:app-magic:12.3'
}
然而,对我来说,app-magic并不是必需的,我会对此发表评论。
我的依赖
FlowableOperator