簡體   English   中英

無法解析項目:CordovaLib

[英]Could not resolve project: CordovaLib

我正在學習如何使用cordova構建應用程序,我現在可以通過谷歌瀏覽器模擬移動屏幕。 我試圖在android平台上測試它,這需要使用Android studio(下載3.0穩定版)。 導入項目后, Gradle項目同步失敗 ,似乎存在解決CordovaLib的某些依賴項的問題。 見下圖

在此輸入圖像描述

我在這里經歷了幾篇文章但仍然無法找到解決方案,或者考慮到這是我第一次用它學習,我可能會錯過這一點。 以下是設置

build.gradle(模塊:CordovaLib)

在此輸入圖像描述

和build.gradle(模塊:android)

在此輸入圖像描述

請問如何解決問題並在模擬器中運行我的應用程序?

是典型的遷移錯誤,請閱讀“遷移本地模塊的依賴關系配置”一節:

您應該按如下方式配置依賴項:

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'
}

trocchietto的解決方案是正確的。 記住你正在使用“CordovaLib”沒有“圖書館”,你只需要像這樣改變。

// 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')

然而,對我來說app-magic並不是必需的,我對它進行了評論。

我的依賴

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'
}

暫無
暫無

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

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