Visual Studio中的Cordova项目无法在Android上构建:找不到com.android.support:support-v4

时间:2018-03-16 16:20:07

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

当我尝试在使用phonegap-plugin-barcodescanner插件的Visual Studio 2017中为Android构建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

1 个答案:

答案 0 :(得分:0)

使用Android SDK Manager(工具> Android> Android SDK Manager)。

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

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

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

然后卸载并重新安装Extras。

下列出的Android支持存储库