Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic platform add android- Package name must look like: com.company.Name

Tags:

ionic

Im getting started in developing ionic app, I followed the guide in http://ionicframework.com/docs/guide/installation.html

just in case: the command "ionic platform add ios" works and i have android sdk installed.

when typing the command "ionic platform add android" i get this error:

Adding android project...  /Users/LihaiMac/.cordova/lib/npm_cache/cordova-android/3.7.1/package/bin/node_modules/q/q.js:126                 throw e;                       ^ Package name must look like: com.company.Name Error: /Users/LihaiMac/.cordova/lib/npm_cache/cordova-android/3.7.1/package/bin/create: Command failed with exit code 1 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23) at ChildProcess.emit (events.js:110:17) at maybeClose (child_process.js:1008:16) at Process.ChildProcess._handle.onexit (child_process.js:1080:5) 

I tried searching an answer in other related posts, but not successful.. I'll appreciate any help in solving my problem..

like image 514
lihai Avatar asked Mar 12 '15 15:03

lihai


2 Answers

What mladen5 said is correct. You need to go to the config.xml of your Cordova/Phonegap project and edit the id to meet the package name expectations.

The name can be found in the ID property and is "com.mydomainhere.appnamehere" in the example config below:

<?xml version='1.0' encoding='utf-8'?> <widget id="com.mydomainhere.appnamehere" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">     <name>Awesome app</name>     <description>         The worlds most awesome app     </description>     <author email="[email protected]" href="http://www.anurlhere.com">         Author name     </author>     <content src="index.html" />     <access origin="*" /> </widget> 
like image 127
EeKay Avatar answered Sep 24 '22 05:09

EeKay


"Package name must look like: com.company.Name" that error is very helpful. You have package name that is invalid, probably starts with number.

Android package rules:

  • The first character after a period must not be a number
  • The first character must be a letter or underscore
  • Usually the app id is your company's reserved Internet domain name.
  • The app id must consist of letters, numbers, and underscores.
like image 25
Mladen Petrovic Avatar answered Sep 24 '22 05:09

Mladen Petrovic