使用Cordova 3.1 CLI构建Android应用程序时出错 [英] Error building Android app with Cordova 3.1 CLI

查看:227
本文介绍了使用Cordova 3.1 CLI构建Android应用程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我尝试通过phonegap CLI运行cordova build android。我首先下载了Android SDK。



然后我设置了项目并添加了android。



然后我试图cordova build android,并收到以下错误: p>


错误:构建Android项目时出错。请
安装Android目标17(Android最新的SDK)。确保您还有
的最新Android工具安装。从
命令行运行android安装/更新任何缺少的SDK或工具。


android并安装与目标17相关的一切。



然后我再次尝试cordova build android,并收到以下编译错误:


-compile:
[javac]将3个源文件编译到/Users/johnmacadam/Desktop/com.test.hello/platforms/android/bin/classes
[javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/src/com/ZZZ.java:20:
';'expected
[javac] package com。英语
[javac] ^
[javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/src/com/ZZZ.java:25:
expected
[javac] public class 501Ways extends CordovaActivity
[javac] ^
[javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/src/com/ZZZ.java:25 :
expected
[javac] public class ZZZ extends CordovaActivity
[javac] ^
[javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/ src / com / ZZZ.java:25:
expected
[javac] public class ZZZ extends CordovaActivity
[javac] ^
[javac] / Users / johnmacadam / Desktop / com .test.hello / platforms / android / gen / com / ZZZ / BuildConfig.java:2:
';'expected
[javac] package com.ZZZ;
[javac] ^
[javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/gen/com/ZZZ/R.java:8:
'; 'expected
[javac] package com.ZZZ;
[javac] ^
[javac] 6个错误



BUILD FAILED
/ Users / johnmacadam / Documents / adt-bundle / sdk /tools/ant/build.xml:720:
执行此行时发生以下错误:
/Users/johnmacadam/Documents/adt-bundle/sdk/tools/ant/build.xml:734 :
编译失败;有关详细信息,请参阅编译器错误输出。


任何想法/建议?

解决方案

在你的config.xml中,你不能有一个小部件id, p>

例如:com.42myapp.test或com.myapp.42test将不会像42com.myapp.test一样工作。
它会从编译器触发一个错误。



错误只会发生在android平台上,iOS处理好。


I am attempting to run "cordova build android" through phonegap CLI with Terminal on my Mac.

First I downloaded the Android SDK.

Then I set up the project and added android.

Then I attempted "cordova build android" and received the following error:

Error: An error occurred while building the android project. Please install Android target 17 (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools.

So I ran "android" and installed everything related to target 17.

Then I attempted "cordova build android" again and receive the following compile errors:

-compile: [javac] Compiling 3 source files to /Users/johnmacadam/Desktop/com.test.hello/platforms/android/bin/classes [javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/src/com/ZZZ.java:20: ';' expected [javac] package com.humorthatworks.501ways; [javac] ^ [javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/src/com/ZZZ.java:25: expected [javac] public class 501Ways extends CordovaActivity [javac] ^ [javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/src/com/ZZZ.java:25: expected [javac] public class ZZZ extends CordovaActivity [javac] ^ [javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/src/com/ZZZ.java:25: expected [javac] public class ZZZ extends CordovaActivity [javac] ^ [javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/gen/com/ZZZ/BuildConfig.java:2: ';' expected [javac] package com.ZZZ; [javac] ^ [javac] /Users/johnmacadam/Desktop/com.test.hello/platforms/android/gen/com/ZZZ/R.java:8: ';' expected [javac] package com.ZZZ; [javac] ^ [javac] 6 errors

BUILD FAILED /Users/johnmacadam/Documents/adt-bundle/sdk/tools/ant/build.xml:720: The following error occurred while executing this line: /Users/johnmacadam/Documents/adt-bundle/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Any ideas/suggestions?

解决方案

In your config.xml you can't have a widget id with number as a first character after a dot.

For example: com.42myapp.test or com.myapp.42test won't work as well as 42com.myapp.test. It will trigger an error from the compiler.

The error will occur only for android platform, iOS handle it well.

这篇关于使用Cordova 3.1 CLI构建Android应用程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆