【问题标题】:Cordova project in Visual Studio fails to build on Android: cannot find com.android.support:support-v4Visual Studio 中的 Cordova 项目无法在 Android 上构建:找不到 com.android.support:support-v4
【发布时间】:2018-08-25 19:01:02
【问题描述】:

当我尝试在 Visual Studio 2017 中为 Android 构建一个使用 phonegap-plugin-barcodescanner 插件的 Cordova 项目时,我收到以下错误:

1>MSBUILD : cordova-build error : * What went wrong:
1>MSBUILD : cordova-build error : A problem occurred configuring root project 'android'.
1>MSBUILD : cordova-build error : > Could not resolve all dependencies for configuration ':_debugCompile'.
1>MSBUILD : cordova-build error :  > Could not find any matches for com.android.support:support-v4:+ as no versions of com.android.support:support-v4 are available.
1>MSBUILD : cordova-build error :  Searched in the following locations:
1>MSBUILD : cordova-build error :  https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
1>MSBUILD : cordova-build error :  https://repo1.maven.org/maven2/com/android/support/support-v4/
1>MSBUILD : cordova-build error :  https://jcenter.bintray.com/com/android/support/support-v4/maven-metadata.xml
1>MSBUILD : cordova-build error :  https://jcenter.bintray.com/com/android/support/support-v4/
1>MSBUILD : cordova-build error :  file:/C:/Users/ischemm/Git/engage-cordova-app/engage-cordova-app/platforms/android/libs/
1>MSBUILD : cordova-build error :  file:/C:/ProgramData/Microsoft/AndroidSDK/25/extras/android/m2repository/com/android/support/support-v4/maven-metadata.xml
1>MSBUILD : cordova-build error :  file:/C:/ProgramData/Microsoft/AndroidSDK/25/extras/android/m2repository/com/android/support/support-v4/
1>MSBUILD : cordova-build error :  Required by:
1>MSBUILD : cordova-build error :  :android:unspecified
1>MSBUILD : cordova-build error : * Try:
1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
1>MSBUILD : cordova-build error : Picked up _JAVA_OPTIONS: -Xmx512M

【问题讨论】:

    标签: android cordova phonegap-plugins visual-studio-cordova


    【解决方案1】:

    使用 Android SDK 管理器(工具 > Android > Android SDK 管理器)。

    首先,将目录更改为 Visual Studio 的 Android SDK 安装目录,通常为:

    C:\ProgramData\Microsoft\AndroidSDK\{version}
    

    (请注意,C:\ProgramData 是一个隐藏文件夹,因此您需要更改文件资源管理器设置以使隐藏文件夹可见。)

    然后卸载并重新安装“附加”下列出的 Android 支持存储库。

    【讨论】:

      猜你喜欢
      • 2014-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多