【发布时间】:2015-03-24 01:05:40
【问题描述】:
我的 Cordova 突然停止工作。
当我最后一次工作时它运行良好 - 大约 2 个月前。
现在当我想继续我的项目时,它给了我错误:
> cordova platforms add android
npm http GET https://registry.npmjs.org/cordova-android/3.7.1
npm http 200 https://registry.npmjs.org/cordova-android/3.7.1
npm http GET https://registry.npmjs.org/cordova-android/-/cordova-android-3.7.1.tgz
npm http 200 https://registry.npmjs.org/cordova-android/-/cordova-android-3.7.1.tgz
Platform android already added.
> cordova run android
Running command: C:\Work\Eclipse\Workspace\Android\CordovaTmp\HelloWorld\platforms\android\cordova\run.bat
"C:\Work\Eclipse\Workspace\Android\CordovaTmp\HelloWorld\platforms\android\cordova\run"
ERROR: Error: Please install Android target "android-19".
Hint: Run "android" from your command-line to open the SDK manager.
ERROR running one or more of the platforms: Error: C:\Work\Eclipse\Workspace\Android\CordovaTmp\HelloWorld\platforms\android\cordova\run.bat: Command failed with exit code 2
You may not have the required environment or OS to run this project
> cordova -version
4.3.0
我查看了这些帖子,但没有任何帮助:link 1、link 2 和 link 3。
此外,即使我在“我的电脑”中的 PATH 变量中添加了工具和平台工具,我也无法在 cygwin shell 上运行“android”
我正在运行 Windows 8.1,cygwin,这是我的 SDK 管理器的样子:
我的平台/android/AndroidManifest.xml 看起来像:
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.foo.helloworld" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="CordovaApp" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="21" />
</manifest>
【问题讨论】:
-
查看 manifest.xml 以获得最小和最大 sdk 以及它可能有帮助的目标 sdk