【发布时间】:2019-08-28 07:41:54
【问题描述】:
我正在使用 Apache Cordova 工具从 VS2017 构建一个 Cordova 应用程序,该应用程序非常简单,它使用:
- 科尔多瓦 6.3.1
- node.js 443
- npm 1.15.0
- cordova-simulate 0.3.13
- cordova-android 5.2.1
- cordova-ios 4.2.0
- cordova-plugin-inappbrowser 3.1.0
- cordova-plugin-whitelist 1.2.2
config.xml 内容:
<?xml version="1.0" encoding="utf-8"?>
<widget defaultlocale="it-IT" id="com.test.test" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps">
<name>Test</name>
<description>Test</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">test</author>
<vs:template-name>BlankJS</vs:template-name>
<content src="index.html" />
<preference name="SplashScreen" value="screen" />
<preference name="windows-target-version" value="10.0" />
<plugin name="cordova-plugin-whitelist" spec="1.2.2" />
<access origin="*" />
<allow-intent href="*" />
<allow-navigation href="*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<platform name="android">
<icon density="ldpi" src="res/icons/android/icon-36-ldpi.png" />
<icon density="mdpi" src="res/icons/android/icon-48-mdpi.png" />
<icon density="hdpi" src="res/icons/android/icon-72-hdpi.png" />
<icon density="xhdpi" src="res/icons/android/icon-96-xhdpi.png" />
</platform>
<platform name="ios">
<icon height="180" src="res/icons/ios/icon-60-3x.png" width="180" />
<icon height="60" src="res/icons/ios/icon-60.png" width="60" />
<icon height="120" src="res/icons/ios/icon-60-2x.png" width="120" />
<icon height="76" src="res/icons/ios/icon-76.png" width="76" />
<icon height="152" src="res/icons/ios/icon-76-2x.png" width="152" />
<icon height="40" src="res/icons/ios/icon-40.png" width="40" />
<icon height="80" src="res/icons/ios/icon-40-2x.png" width="80" />
<icon height="57" src="res/icons/ios/icon-57.png" width="57" />
<icon height="114" src="res/icons/ios/icon-57-2x.png" width="114" />
<icon height="72" src="res/icons/ios/icon-72.png" width="72" />
<icon height="144" src="res/icons/ios/icon-72-2x.png" width="144" />
<icon height="29" src="res/icons/ios/icon-small.png" width="29" />
<icon height="58" src="res/icons/ios/icon-small-2x.png" width="58" />
<icon height="50" src="res/icons/ios/icon-50.png" width="50" />
<icon height="100" src="res/icons/ios/icon-50-2x.png" width="100" />
</platform>
<platform name="windows">
<icon height="150" src="res/icons/windows/Square150x150Logo.scale-100.png" width="150" />
<icon height="360" src="res/icons/windows/Square150x150Logo.scale-240.png" width="360" />
<icon height="30" src="res/icons/windows/Square30x30Logo.scale-100.png" width="30" />
<icon height="310" src="res/icons/windows/Square310x310Logo.scale-100.png" width="310" />
<icon height="44" src="res/icons/windows/Square44x44Logo.scale-100.png" width="44" />
<icon height="106" src="res/icons/windows/Square44x44Logo.scale-240.png" width="106" />
<icon height="70" src="res/icons/windows/Square70x70Logo.scale-100.png" width="70" />
<icon height="71" src="res/icons/windows/Square71x71Logo.scale-100.png" width="71" />
<icon height="170" src="res/icons/windows/Square71x71Logo.scale-240.png" width="170" />
<icon height="50" src="res/icons/windows/StoreLogo.scale-100.png" width="50" />
<icon height="120" src="res/icons/windows/StoreLogo.scale-240.png" width="120" />
<icon height="150" src="res/icons/windows/Wide310x150Logo.scale-100.png" width="310" />
<icon height="360" src="res/icons/windows/Wide310x150Logo.scale-240.png" width="744" />
</platform>
<platform name="android">
<splash density="land-hdpi" src="res/screens/android/screen-hdpi-landscape.png" />
<splash density="land-ldpi" src="res/screens/android/screen-ldpi-landscape.png" />
<splash density="land-mdpi" src="res/screens/android/screen-mdpi-landscape.png" />
<splash density="land-xhdpi" src="res/screens/android/screen-xhdpi-landscape.png" />
<splash density="port-hdpi" src="res/screens/android/screen-hdpi-portrait.png" />
<splash density="port-ldpi" src="res/screens/android/screen-ldpi-portrait.png" />
<splash density="port-mdpi" src="res/screens/android/screen-mdpi-portrait.png" />
<splash density="port-xhdpi" src="res/screens/android/screen-xhdpi-portrait.png" />
</platform>
<platform name="ios">
<splash height="480" src="res/screens/ios/screen-iphone-portrait.png" width="320" />
<splash height="960" src="res/screens/ios/screen-iphone-portrait-2x.png" width="640" />
<splash height="1024" src="res/screens/ios/screen-ipad-portrait.png" width="768" />
<splash height="2048" src="res/screens/ios/screen-ipad-portrait-2x.png" width="1536" />
<splash height="768" src="res/screens/ios/screen-ipad-landscape.png" width="1024" />
<splash height="1536" src="res/screens/ios/screen-ipad-landscape-2x.png" width="2048" />
<splash height="1136" src="res/screens/ios/screen-iphone-568h-2x.png" width="640" />
<splash height="1334" src="res/screens/ios/screen-iphone-portrait-667h.png" width="750" />
<splash height="2208" src="res/screens/ios/screen-iphone-portrait-736h.png" width="1242" />
<splash height="1242" src="res/screens/ios/screen-iphone-landscape-736h.png" width="2208" />
</platform>
<platform name="windows">
<splash height="300" src="res/screens/windows/SplashScreen.scale-100.png" width="620" />
<splash height="1920" src="res/screens/windows/SplashScreen.scale-240.png" width="1152" />
<splash height="1920" src="res/screens/windows/SplashScreenPhone.scale-240.png" width="1152" />
</platform>
<plugin name="cordova-plugin-inappbrowser" spec="~3.1.0" />
<preference name="Fullscreen" value="True" />
<preference name="android-minSdkVersion" value="15" />
<preference name="android-targetSdkVersion" value="28" />
<vs:toolsetVersion>6.3.1</vs:toolsetVersion>
<engine name="android" spec="~5.2.1" />
<engine name="ios" spec="~4.2.0" />
<engine name="windows" spec="~4.4.2" />
</widget>
当我构建 Android 时,我得到:
1>MSBUILD:cordova-build 错误: c:\DemoApp\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:1190: 错误:找不到符号 1>MSBUILD:cordova-build 错误: @TargetApi(Build.VERSION_CODES.N) 1>MSBUILD:cordova-build 错误:^ 1>MSBUILD:cordova-build 错误:符号:变量 N 1>MSBUILD: 科尔多瓦构建错误:位置:类 VERSION_CODES 1>MSBUILD: 科尔多瓦构建错误: c:\DemoApp\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:268: 错误:找不到符号 1>MSBUILD:cordova-build 错误:如果 (android.os.Build.VERSION.SDK_INT MSBUILD:cordova-build 错误:^ 1>MSBUILD:cordova-build 错误: 符号:变量 O 1>MSBUILD:cordova-build 错误:位置:类 VERSION_CODES 1>MSBUILD:cordova-build 错误: c:\DemoApp\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:272: 错误:找不到符号 1>MSBUILD:cordova-build 错误: ((InAppBrowserClient)inAppWebView.getWebViewClient()).waitForBeforeload =假; 1>MSBUILD:cordova-build 错误:^ 1>MSBUILD:cordova-build 错误:符号:方法 getWebViewClient() 1>MSBUILD: cordova-build 错误:位置:WebView 类型的变量 inAppWebView 1>MSBUILD:cordova-build 错误: c:\DemoApp\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:1191: 错误:方法没有覆盖或实现超类型中的方法 1>MSBUILD:cordova-build 错误:@Override 1>MSBUILD:cordova-build 错误:^
我尝试使用 VS Take latest patch 检查并从 CLI 将 cordova-android 更新到 8.0.0,但 Visual Studio 仍然在 thr GUI 中显示 5.2.1,问题仍然存在。
【问题讨论】:
标签: cordova visual-studio-2017 inappbrowser