简体   繁体   English

无法在Ubuntu 14.04上添加Cordova Platform Android

[英]Unable to add cordova platform android on Ubuntu 14.04

I am running a newly installed ubuntu 14.04 system, I am unable to get past the following error, please help 我正在运行新安装的ubuntu 14.04系统,我无法摆脱以下错误,请帮助

hoomi@hoomi-Vostro-3446:~/work/boozing/boozing-mobile$ sudo cordova platform add android
npm http GET https://registry.npmjs.org/cordova-android/4.0.0
npm http 200 https://registry.npmjs.org/cordova-android/4.0.0
npm http GET https://registry.npmjs.org/cordova-android/-/cordova-android-4.0.0.tgz
npm http 200 https://registry.npmjs.org/cordova-android/-/cordova-android-4.0.0.tgz
Adding android project...

/home/hoomi/.cordova/lib/npm_cache/cordova-android/4.0.0/package/bin/node_modules/q/q.js:126
                    throw e;
                          ^
Package name must look like: com.company.Name
Error: /home/hoomi/.cordova/lib/npm_cache/cordova-android/4.0.0/package/bin/create: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)
hoomi@hoomi-Vostro-3446:~/work/boozing/boozing-mobile$ 
 Package name must look like: com.company.Name 

This tells it has something to do with your application's package name. 这表明它与应用程序的程序包名称有关。

If you check your config.xml in your app's root folder, you will find your package name with the value against id . 如果在应用程序的根文件夹中检查config.xml ,则将找到带有id包名称。 For example: 例如:

<widget id="com.example.hello" version="0.0.1">

So, check the package name in there, Android's documentation will guide you for naming your package name: 因此,请检查其中的包名称, Android文档将指导您命名包名称:

A full Java-language-style package name for the application. 应用程序的完整Java语言样式程序包名称。 The name should be unique. 名称应唯一。 The name may contain uppercase or lowercase letters ('A' through 'Z'), numbers, and underscores ('_'). 该名称可以包含大写或小写字母(“ A”至“ Z”),数字和下划线(“ _”)。 However, individual package name parts may only start with letters . 但是, 单个包装名称部分只能以字母开头 To avoid conflicts with other developers, you should use Internet domain ownership as the basis for your package names (in reverse). 为避免与其他开发人员发生冲突,您应使用Internet域所有权作为程序包名称的基础(相反)。 For example, applications published by Google start with com.google. 例如,由Google发布的应用程序以com.google开头。 You should also never use the com.example namespace when publishing your applications. 发布应用程序时,也永远不要使用com.example命名空间。

The package name serves as a unique identifier for the application. 程序包名称用作应用程序的唯一标识符。 It's also the default name for the application process (see the element's process process attribute) and the default task affinity of an activity (see the element's taskAffinity attribute). 它也是应用程序流程的默认名称(请参阅元素的流程属性)和活动的默认任务关联(请参见元素的taskAffinity属性)。

Caution : Once you publish your application, you cannot change the package name. 警告 :发布应用程序后,您将无法更改程序包名称。 The package name defines your application's identity, so if you change it, then it is considered to be a different application and users of the previous version cannot update to the new version. 程序包名称定义了您的应用程序的身份,因此,如果您更改它的名称,则它将被视为另一个应用程序,并且以前版本的用户无法更新到新版本。

If I can see it right, you may have used a - (hyphen) in your app's package name. 如果我看对了,则可能是您的应用程序包名称中使用了- (连字符)。 So in that case, you will have to remove it. 因此,在这种情况下,您将必须删除它。

As per this Answer by Mladen , you need to follow all the rules of writing the package name. 按照Mladen的“答案” ,您需要遵循编写程序包名称的所有规则。

I faced the same issue where i had '-' in my company name 我遇到公司名称中带有“-”的相同问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM