2016-08-20 66 views
1

我创建了一个项目,它具有简单登录的电话差距,并且可以在手机上使用phonegap开发人员应用程序正常工作。使用Cordova构建Android应用程序时出错

当我试图使用命令

cordova build android 

我收到以下错误

Error: Source path does not exist: www/res/screen/android/drawable-land-xxhdpi-screen.png

当我检查错误消息中提到的路径来构建Android应用程序,我的文件是不在那里。相反,drawable-land-xhdpi-screen.png在那里。所以,我刚才复制的文件,并将其重命名为绘制,土地xxhdpi-screen.png然后我试着用命令

cordova build android 

再次构建和我再次得到了同样的错误。当我再次检查路径时,我添加的文件似乎不再存在。

请帮我解决这个问题,并构建应用程序。

SCREENSHOT

enter image description here

config.xml中是

<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="com.g10solution.okornot" version="1.0.0"> 
 
    <name>G10 OK or NOT App</name> 
 
    <description>Hello World sample application that responds to the deviceready event.</description> 
 
    <author href="http://phonegap.com" email="[email protected]">PhoneGap Team</author> 
 
    <content src="index.html"/> 
 
    <preference name="DisallowOverscroll" value="true"/> 
 
    <preference name="android-minSdkVersion" value="14"/> 
 
    <plugin name="cordova-plugin-battery-status" source="npm" spec="~1.1.1"/> 
 
    <plugin name="cordova-plugin-camera" source="npm" spec="~2.1.1"/> 
 
    <plugin name="cordova-plugin-media-capture" source="npm" spec="~1.2.0"/> 
 
    <plugin name="cordova-plugin-console" source="npm" spec="~1.0.2"/> 
 
    <plugin name="cordova-plugin-contacts" source="npm" spec="~2.0.1"/> 
 
    <plugin name="cordova-plugin-device" source="npm" spec="~1.1.1"/> 
 
    <plugin name="cordova-plugin-device-motion" source="npm" spec="~1.2.0"/> 
 
    <plugin name="cordova-plugin-device-orientation" source="npm" spec="~1.0.2"/> 
 
    <plugin name="cordova-plugin-dialogs" source="npm" spec="~1.2.0"/> 
 
    <plugin name="cordova-plugin-file" source="npm" spec="~4.1.1"/> 
 
    <plugin name="cordova-plugin-file-transfer" source="npm" spec="~1.5.0"/> 
 
    <plugin name="cordova-plugin-geolocation" source="npm" spec="~2.1.0"/> 
 
    <plugin name="cordova-plugin-globalization" source="npm" spec="~1.0.3"/> 
 
    <plugin name="cordova-plugin-inappbrowser" source="npm" spec="~1.3.0"/> 
 
    <plugin name="cordova-plugin-media" source="npm" spec="~2.2.0"/> 
 
    <plugin name="cordova-plugin-network-information" source="npm" spec="~1.2.0"/> 
 
    <plugin name="cordova-plugin-splashscreen" source="npm" spec="~3.2.1"/> 
 
    <plugin name="cordova-plugin-statusbar" source="npm" spec="~2.1.2"/> 
 
    <plugin name="cordova-plugin-vibration" source="npm" spec="~2.1.0"/> 
 
    <plugin name="cordova-plugin-whitelist" source="npm" spec="~1.2.1"/> 
 
    <icon src="icon.png"/> 
 
    <platform name="android"> 
 
    <icon src="www/res/icon/android/drawable-ldpi-icon.png" density="ldpi"/> 
 
    <icon src="www/res/icon/android/drawable-mdpi-icon.png" density="mdpi"/> 
 
    <icon src="www/res/icon/android/drawable-hdpi-icon.png" density="hdpi"/> 
 
    <icon src="www/res/icon/android/drawable-xhdpi-icon.png" density="xhdpi"/> 
 
    <icon src="www/res/icon/android/drawable-xxhdpi-icon.png" density="xxhdpi"/> 
 
    <icon src="www/res/icon/android/drawable-xxxhdpi-icon.png" density="xxxhdpi"/> 
 
    <splash src="www/res/screen/android/drawable-land-ldpi-screen.png" density="land-ldpi"/> 
 
    <splash src="www/res/screen/android/drawable-land-mdpi-screen.png" density="land-mdpi"/> 
 
    <splash src="www/res/screen/android/drawable-land-hdpi-screen.png" density="land-hdpi"/> 
 
    <splash src="www/res/screen/android/drawable-land-xhdpi-screen.png" density="land-xhdpi"/> 
 
    <splash src="www/res/screen/android/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/> 
 
    <splash src="www/res/screen/android/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/> 
 
    <splash src="www/res/screen/android/drawable-port-ldpi-screen.png" density="port-ldpi"/> 
 
    <splash src="www/res/screen/android/drawable-port-mdpi-screen.png" density="port-mdpi"/> 
 
    <splash src="www/res/screen/android/drawable-port-hdpi-screen.png" density="port-hdpi"/> 
 
    <splash src="www/res/screen/android/drawable-port-xhdpi-screen.png" density="port-xhdpi"/> 
 
    <splash src="www/res/screen/android/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/> 
 
    <splash src="www/res/screen/android/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/> 
 
    </platform> 
 
    <platform name="ios"> 
 
    <icon src="www/res/icon/ios/icon.png" platform="ios" width="57" height="57"/> 
 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="114" height="114"/> 
 
    <icon src="www/res/icon/ios/icon-40.png" platform="ios" width="40" height="40"/> 
 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="80" height="80"/> 
 
    <icon src="www/res/icon/ios/icon-50.png" platform="ios" width="50" height="50"/> 
 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="100" height="100"/> 
 
    <icon src="www/res/icon/ios/icon-60.png" platform="ios" width="60" height="60"/> 
 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="120" height="120"/> 
 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="180" height="180"/> 
 
    <icon src="www/res/icon/ios/icon-72.png" platform="ios" width="72" height="72"/> 
 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="144" height="144"/> 
 
    <icon src="www/res/icon/ios/icon-76.png" platform="ios" width="76" height="76"/> 
 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="152" height="152"/> 
 
    <icon src="www/res/icon/ios/icon-small.png" platform="ios" width="29" height="29"/> 
 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="58" height="58"/> 
 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="87" height="87"/> 
 
    <splash src="www/res/screen/ios/[email protected]~iphone.png" platform="ios" width="640" height="1136"/> 
 
    <splash src="www/res/screen/ios/Default-667h.png" platform="ios" width="750" height="1334"/> 
 
    <splash src="www/res/screen/ios/Default-736h.png" platform="ios" width="1242" height="2208"/> 
 
    <splash src="www/res/screen/ios/Default-Landscape-736h.png" platform="ios" width="2208" height="1242"/> 
 
    <splash src="www/res/screen/ios/[email protected]~ipad.png" platform="ios" width="2048" height="1536"/> 
 
    <splash src="www/res/screen/ios/Default-Landscape~ipad.png" platform="ios" width="1024" height="768"/> 
 
    <splash src="www/res/screen/ios/[email protected]~ipad.png" platform="ios" width="1536" height="2048"/> 
 
    <splash src="www/res/screen/ios/Default-Portrait~ipad.png" platform="ios" width="768" height="1024"/> 
 
    <splash src="www/res/screen/ios/[email protected]~iphone.png" platform="ios" width="640" height="960"/> 
 
    <splash src="www/res/screen/ios/Default~iphone.png" platform="ios" width="320" height="480"/> 
 
    </platform> 
 
    <platform name="wp8"> 
 
    <icon src="www/res/icon/wp8/ApplicationIcon.png" platform="wp8" width="99" height="99"/> 
 
    <icon src="www/res/icon/wp8/Background.png" platform="wp8" width="159" height="159"/> 
 
    <splash src="www/res/screen/wp8/screen-portrait.jpg" platform="wp8" width="768" height="1280"/> 
 
    </platform> 
 
    <platform name="windows"> 
 
    <icon src="www/res/icon/windows/Square150x150Logo.scale-100.png" platform="windows" width="150" height="150"/> 
 
    <icon src="www/res/icon/windows/Square30x30Logo.scale-100.png" platform="windows" width="30" height="30"/> 
 
    <icon src="www/res/icon/windows/StoreLogo.scale-100.png" platform="windows" width="50" height="50"/> 
 
    <splash src="www/res/screen/windows/SplashScreen.scale-100.png" platform="windows" width="620" height="300"/> 
 
    <icon src="www/res/icon/windows/StoreLogo.scale-240.png" platform="windows" width="120" height="120"/> 
 
    <icon src="www/res/icon/windows/Square44x44Logo.scale-100.png" platform="windows" width="44" height="44"/> 
 
    <icon src="www/res/icon/windows/Square44x44Logo.scale-240.png" platform="windows" width="106" height="106"/> 
 
    <icon src="www/res/icon/windows/Square70x70Logo.scale-100.png" platform="windows" width="70" height="70"/> 
 
    <icon src="www/res/icon/windows/Square71x71Logo.scale-100.png" platform="windows" width="71" height="71"/> 
 
    <icon src="www/res/icon/windows/Square71x71Logo.scale-240.png" platform="windows" width="170" height="170"/> 
 
    <icon src="www/res/icon/windows/Square150x150Logo.scale-240.png" platform="windows" width="360" height="360"/> 
 
    <icon src="www/res/icon/windows/Square310x310Logo.scale-100.png" platform="windows" width="310" height="310"/> 
 
    <icon src="www/res/icon/windows/Wide310x150Logo.scale-100.png" platform="windows" width="310" height="150"/> 
 
    <icon src="www/res/icon/windows/Wide310x150Logo.scale-240.png" platform="windows" width="744" height="360"/> 
 
    <splash src="www/res/screen/windows/SplashScreenPhone.scale-240.png" platform="windows" width="1152" height="1920"/> 
 
    </platform> 
 
    <access origin="*"/> 
 
    <allow-intent href="http://*/*"/> 
 
    <allow-intent href="https://*/*"/> 
 
    <allow-intent href="tel:*"/> 
 
    <allow-intent href="sms:*"/> 
 
    <allow-intent href="mailto:*"/> 
 
    <allow-intent href="geo:*"/> 
 
    <platform name="android"> 
 
    <allow-intent href="market:*"/> 
 
    </platform> 
 
    <platform name="ios"> 
 
    <allow-intent href="itms:*"/> 
 
    <allow-intent href="itms-apps:*"/> 
 
    </platform> 
 
</widget>

+0

你试图重新添加android平台? –

+0

是的。但仍然得到相同的错误 – AeJey

+0

AeJey的解决方案是什么? 我与科尔多瓦6.5.0 Cordova平台ios 4.3.1有同样的问题:错误:源路径不存在:res/ios/icon-40.png。 – Ric

回答

2

我在过去面临过这样的问题。你可能有一个名为screen.png的PNG文件。

为'land-xxhdpi'限定符创建一个可绘制文件夹,“在www/res/screen/android /下创建一个文件夹drawable-land-xxhdpi”,并将screen.png文件放在该文件夹下。你可以使用相同的图像,但你应该使用xxhdpi分辨率的图像。

然后尝试运行命令

  • 科尔多瓦构建Android
+0

我创建了一个名为drawable-land-xxhdpi的文件夹,并在其中复制了screen.png。但我仍然得到相同的错误“错误:源路径不存在:www/res/screen/android/drawable-land-xxhdpi-screen.png” – AeJey

+0

您是将它保存在/ Platforms/android /文件夹下?你能分享你的文件夹结构,可能是截图。 – rahul

+0

添加到问题的截图。请检查。 – AeJey

3

我只是有这个问题,并能够通过做两件事情来解决这个问题:
1.删除所有这从你的config.xml

<icon src="icon.png"/> 
    <platform name="android"> 
    <icon src="www/res/icon/android/drawable-ldpi-icon.png" density="ldpi"/> 
    <icon src="www/res/icon/android/drawable-mdpi-icon.png" density="mdpi"/> 
    <icon src="www/res/icon/android/drawable-hdpi-icon.png" density="hdpi"/> 
    <icon src="www/res/icon/android/drawable-xhdpi-icon.png" density="xhdpi"/> 
    <icon src="www/res/icon/android/drawable-xxhdpi-icon.png" density="xxhdpi"/> 
    <icon src="www/res/icon/android/drawable-xxxhdpi-icon.png" density="xxxhdpi"/> 
    <splash src="www/res/screen/android/drawable-land-ldpi-screen.png" density="land-ldpi"/> 
    <splash src="www/res/screen/android/drawable-land-mdpi-screen.png" density="land-mdpi"/> 
    <splash src="www/res/screen/android/drawable-land-hdpi-screen.png" density="land-hdpi"/> 
    <splash src="www/res/screen/android/drawable-land-xhdpi-screen.png" density="land-xhdpi"/> 
    <splash src="www/res/screen/android/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/> 
    <splash src="www/res/screen/android/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/> 
    <splash src="www/res/screen/android/drawable-port-ldpi-screen.png" density="port-ldpi"/> 
    <splash src="www/res/screen/android/drawable-port-mdpi-screen.png" density="port-mdpi"/> 
    <splash src="www/res/screen/android/drawable-port-hdpi-screen.png" density="port-hdpi"/> 
    <splash src="www/res/screen/android/drawable-port-xhdpi-screen.png" density="port-xhdpi"/> 
    <splash src="www/res/screen/android/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/> 
    <splash src="www/res/screen/android/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/> 
    </platform> 
    <platform name="ios"> 
    <icon src="www/res/icon/ios/icon.png" platform="ios" width="57" height="57"/> 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="114" height="114"/> 
    <icon src="www/res/icon/ios/icon-40.png" platform="ios" width="40" height="40"/> 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="80" height="80"/> 
    <icon src="www/res/icon/ios/icon-50.png" platform="ios" width="50" height="50"/> 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="100" height="100"/> 
    <icon src="www/res/icon/ios/icon-60.png" platform="ios" width="60" height="60"/> 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="120" height="120"/> 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="180" height="180"/> 
    <icon src="www/res/icon/ios/icon-72.png" platform="ios" width="72" height="72"/> 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="144" height="144"/> 
    <icon src="www/res/icon/ios/icon-76.png" platform="ios" width="76" height="76"/> 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="152" height="152"/> 
    <icon src="www/res/icon/ios/icon-small.png" platform="ios" width="29" height="29"/> 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="58" height="58"/> 
    <icon src="www/res/icon/ios/[email protected]" platform="ios" width="87" height="87"/> 
    <splash src="www/res/screen/ios/[email protected]~iphone.png" platform="ios" width="640" height="1136"/> 
    <splash src="www/res/screen/ios/Default-667h.png" platform="ios" width="750" height="1334"/> 
    <splash src="www/res/screen/ios/Default-736h.png" platform="ios" width="1242" height="2208"/> 
    <splash src="www/res/screen/ios/Default-Landscape-736h.png" platform="ios" width="2208" height="1242"/> 
    <splash src="www/res/screen/ios/[email protected]~ipad.png" platform="ios" width="2048" height="1536"/> 
    <splash src="www/res/screen/ios/Default-Landscape~ipad.png" platform="ios" width="1024" height="768"/> 
    <splash src="www/res/screen/ios/[email protected]~ipad.png" platform="ios" width="1536" height="2048"/> 
    <splash src="www/res/screen/ios/Default-Portrait~ipad.png" platform="ios" width="768" height="1024"/> 
    <splash src="www/res/screen/ios/[email protected]~iphone.png" platform="ios" width="640" height="960"/> 
    <splash src="www/res/screen/ios/Default~iphone.png" platform="ios" width="320" height="480"/> 
    </platform> 
    <platform name="wp8"> 
    <icon src="www/res/icon/wp8/ApplicationIcon.png" platform="wp8" width="99" height="99"/> 
    <icon src="www/res/icon/wp8/Background.png" platform="wp8" width="159" height="159"/> 
    <splash src="www/res/screen/wp8/screen-portrait.jpg" platform="wp8" width="768" height="1280"/> 
    </platform> 
    <platform name="windows"> 
    <icon src="www/res/icon/windows/Square150x150Logo.scale-100.png" platform="windows" width="150" height="150"/> 
    <icon src="www/res/icon/windows/Square30x30Logo.scale-100.png" platform="windows" width="30" height="30"/> 
    <icon src="www/res/icon/windows/StoreLogo.scale-100.png" platform="windows" width="50" height="50"/> 
    <splash src="www/res/screen/windows/SplashScreen.scale-100.png" platform="windows" width="620" height="300"/> 
    <icon src="www/res/icon/windows/StoreLogo.scale-240.png" platform="windows" width="120" height="120"/> 
    <icon src="www/res/icon/windows/Square44x44Logo.scale-100.png" platform="windows" width="44" height="44"/> 
    <icon src="www/res/icon/windows/Square44x44Logo.scale-240.png" platform="windows" width="106" height="106"/> 
    <icon src="www/res/icon/windows/Square70x70Logo.scale-100.png" platform="windows" width="70" height="70"/> 
    <icon src="www/res/icon/windows/Square71x71Logo.scale-100.png" platform="windows" width="71" height="71"/> 
    <icon src="www/res/icon/windows/Square71x71Logo.scale-240.png" platform="windows" width="170" height="170"/> 
    <icon src="www/res/icon/windows/Square150x150Logo.scale-240.png" platform="windows" width="360" height="360"/> 
    <icon src="www/res/icon/windows/Square310x310Logo.scale-100.png" platform="windows" width="310" height="310"/> 
    <icon src="www/res/icon/windows/Wide310x150Logo.scale-100.png" platform="windows" width="310" height="150"/> 
    <icon src="www/res/icon/windows/Wide310x150Logo.scale-240.png" platform="windows" width="744" height="360"/> 
    <splash src="www/res/screen/windows/SplashScreenPhone.scale-240.png" platform="windows" width="1152" height="1920"/> 
    </platform> 

(所以没有对config.xml中的图像的引用,而是使用cordova-icon,这让生活变得更轻松)

  • 获取Android API V23(使用Android SDK管理器($ android))
  • 相关问题