While experienced with phonegap and xcode, I\'m new to android. I have installed phonegap 3.0 ...
npm install phonegap
phonegap --version
3.0.0-0.14.3
Simply open your AndroidManifest.xml file and set minimun and targeted version. In your case 18. Same answer to question Phonegap 3.0 CLI issue android target number in build app. AndroidManifest.xml file is located in: YOURPROJECT\platforms\android. If you need more assistance ask, will try to help you. Post your AndroidManifest.xml file so I can check.
Go to \cordova\src\metadata\android_parser.js in function check_requirements
and change the lines 56,57,66 from 17 to 18. It will then be ok.
I think you have the wrong version of Phonegap, mine says 0.3.0-0.15.0
. I think Fil's fix would definitely have made it into the final build, so I think you must be doing something goofy when installing Phonegap. This is what I did:
npm install cordova -g
(or I guess in your case it would be Phonegap and not cordova.) This will install cordova (or phonegap) globally so that you can access it anywhere with the 'cordova' command. If you already have it installed try npm update
instead of npm install
.
Navigate to a workspace location, like C:\workspace
.
Type cordova create MyApp
which will create a Cordova project at C:\workspace\MyApp
. The workspace will have the following folders:
/www/
- where you place all of your HTML and JavaScript
/platforms/
- this will have folders for android, ios, and any other platforms you add. Your stuff from /www/ will get copied over here in the right place for each platform. This is where you would edit platform-specific files, for example, to change the target-sdk, you want to edit /platforms/android/AndroidManifest.xml
.
/plugins/
- this is where all of the plugin code will go when you do cordova plugin add {link}
. I can't think of any reason why you should ever edit anything in this folder (but there probably are some good ones.)
/merges/
- any files here will get merged with the corresponding files in /www/
and pushed into /platforms/
, see the documentation.
After running the create command, you need to add the platforms:
cd MyApp
cordova platform add android -d
- the -d gives us debug info
cordova build android
- this will build the android app and you will see stuff from /www/
copied over to /platforms/android/assets/www
.
One
If you are still having issues, did you try what it says in the output, that is, running android
from the command line? This will bring up the "Android SDK Manager", make sure that you have the latest version of the SDK installed as well as the latest Android SDK Tools and Android SDK Platform-tools (mine are 22.0.5 and 18.0.1, respectively.)
There may also be issues if you have never created an Android emulator object (use the AVD manager) although that sounds less likely.
C:\Users\USER_NAME.cordova\lib\android\cordova\3.1.0\framework\
should be in bumerang's anser
C:\Users\USER_NAME.cordova\lib\android\cordova\3.1.0\framework\project.properties
reading from the release notes of version 3.1.0, it says:
- Incremeting version check for Android 4.3 API Level 18
- Upgrading project to Android 4.3
Therefore, upgrading to Phonegap 3.1.0 should do the trick.
Find file android_parser.js
in Windows it is undr path:
C:\Users\USER_NAME\AppData\Roaming\npm\node_modules\cordova\src\metadata
change in file android_parse.js
OR if You are makking application from PhoneGap not Cordova:
C:\Users\USER_NAME\AppData\Roaming\npm\node_modules\phonegap\node_modules\cordova\src\metadata\android_parser.js
go to line: 57
if (output.indexOf('android-17') == -1) {
and change it for:
if (output.indexOf('android') == -1) {
This will let You not to wory about future :)
But then You can occur this Error
[Error: An error occured during creation of android sub-project.
]
To fix it You will have to goto this path:
C:\Users\USER_NAME\.cordova\lib\android\cordova\3.1.0\framework\project.properties
And change this line:
target=android-17
To this:
target=android-19
Or whatever is Your Android SDK version
What to do if You want to use Android 2.2 ?
Just simple go to:
Your_Project_Folder/platforms/android/AndroidManifest.xml
And change:
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
To:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="19" />
And after that import Your project to Your IDE
Enjoy :)