In my Windows 7 machine, I had ionic build android working. I could build the apk, deploy/debug with ionic run android --livereload --consolelogs etc. All of sudden (as in I don't know what possibly could have caused this), the ionic build android stopped working. When I try to run it, it freezes in this screen:
ajunior#DES6635D C:\src\to\my\project
> ionic build android
Running command: "C:\Program Files\nodejs\node.exe" C:\src\to\my\project\hooks\after_prepare\010_add_platform_class.js C:\src\to\my\project
add to body class: platform-android
Running command: cmd "/s /c "C:\src\to\my\project\platforms\android\cordova\build.bat""
Event after an hour or so, no output is given; I have to manually break the process with Ctrl+C.
Any suggestions? The strange thing is that this was working this morning (and all the other days for the last two weeks), so I believe that it's not related to PATH, Android SDK or anything like that. Nothing was installed, uninstalled or updated in this time. I already tried restarting the machine, but that also didn't work.
When in path via cmd run: cordova build android --ant
It will build like that (you must have ant installed of course).
Then: cordova run android
If cordova run android gives issues just fetch the apk from the build folder in your ionic project:
platforms\android\build\outputs\apk
Then allow cellphone to accept Unknown Sources, copy the file to your phone and install.
Related
I am developing an ionic android app and it generates the output apk file inside
project->platforms->android->build->outputs
Then inorder to test the app, i am forced to manually copy the apk file to my device to install app on it. So is there any way by which i can directly install the apk in my device when i build the ionic project through terminal? In android studio, the app get installed on the device when we run the project. I am looking for same kind of methode with ionic.
I suppose you are running ionic build android.
You need to run the command ionic run android.
If your ANDROID_HOME path is correctly set, it will run in your connected device or if no device is connected, it will start your android emulator device.
You can also run this command ionic run android --device. If your ANDROID_HOME path is correctly set, it will run in your connected device as well.
Ive finnished a final year project using phonegap on OSX and i want to make a APK for user testing.
When i've been testing the app on my android tablet i use
phonegap run android // or // cordova run android
it builds and goes onto my android device fine, works properly and all the plugins work fine, however i want to be able to make its own .APK file so friends can test it and give me feedback.
I was told to use
phonegap build android --release
When i use this command it will fall over with an exit code 1 saying i may not have the required platform or OS to build this project, despite when running the previous command it says build fine.
Error code in CLI
BUILD FAILED
Total time: 4.202 secs
/Users/robertlemm/Development/phonegap_dev/Little_Scavngers/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/robertlemm/Development/phonegap_dev/Little_Scavngers/platforms/android/gradlew with args: cdvBuildRelease,-b,/Users/robertlemm/Development/phonegap_dev/Little_Scavngers/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/robertlemm/Development/phonegap_dev/Little_Scavngers/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/robertlemm/Development/phonegap_dev/Little_Scavngers/platforms/android/cordova/build: Command failed with exit code 1
I've ensured android tools & platform tools are up in my $PATH, checked SDK manager to ensure ive got version 14 to latest installed, checked the Platforms.JSON file to ensure the versions are set to the minimum, the config.xml
says <preference name="android-minSdkVersion" value="16" />
Honestly not sure how to do it
Have you tried removing and adding again the android platform?
I remember having this issue several times and fixing it by just doing that.
I am trying, to no avail, to run an Android version of a Phonegap app I have made.
The app works fine on iOS when running:
phonegap run ios
However, when I run:
phonegap run android
I get
[phonegap] executing 'cordova run android'...
[phonegap] completed 'cordova run android'`
But nothing happens. When I run:
phonegap run android --verbose
I get the error(s):
BUILD FAILED
/usr/local/Cellar/android-sdk/24.1.2/tools/ant/build.xml:601: The following error occurred while executing this line:
/usr/local/Cellar/android-sdk/24.1.2/tools/ant/build.xml:653: The following error occurred while executing this line:
/usr/local/Cellar/android-sdk/24.1.2/tools/ant/build.xml:698: null returned: 1
and
ERROR running one or more of the platforms: Error: /Users/*/Google Drive/Websites/angular-phonegap/*/platforms/android/cordova/run: Command failed with exit code 1
You may not have the required environment or OS to run this project
I faced a similar problem in the past that involved editing my PATH variable, not sure if this is the same issue or what. In any case, any help is greatly appreciated.
Thanks
i think that you not have all requirements, please check another time, as you can see here, cordova fail with this error where not find a specific platform command to run.
Follow these instruction:
Check that the java sdk is already installed and already in your Path.
Check to have already installed android studio or sdk standalone and the bin folder of the sdk is in Path.
Check to have installed ant ( on Mac install it with brew, this is the best option ) and to have it in path.
For a complete list to check refer to this cordova docs.
Be patient and follow the step one by one, your problem must be in one of these steps.
I installed latest version of phonegap with npm, which shows version 4, and latest android sdk.
After creating simple myApp "hello world" project to test, I added android platform and can do local build and run the app with phonegap developer app on my phone.
But... if I do a remote phonegap build then the error log from build.phonegap.com for this app shows
'Error: The command "android" failed. Make sure you have the latest Android SDK installed, and the "android" command (inside the tools/ folder) is added to your path.'
I have JAVA_HOME and ANT_HOME configured and ant and the android sdk tools and platform-tools are in my path.
I can execute android from cmd shell to bring up SDK Manager.
This is all on Windows 7 64 bit.
I'm probably missing something simple, but driving me nuts that I can't do a remote build.
It appears that there was a temporary problem with the phonegap build service, which is now working again.
Ah well...
I am trying to build a Cordova project on Windows using the steps I was given by the team who developed it.
Install Bower, Cordova CLI, Grunt CLI, SASS/Compass/sass-globbing gems
grunt build
cordova platforms add android
Then trying to run grunt emulate android but getting an error. I have the Android SDK installed and can fire up an emulator but I'm getting the following when trying to run that command:
Warning: Task "android" not found. Use --force to continue.
What am I doing wrong? I'm new to Cordova/PhoneGap development and all this interplay between packages is daunting.
You probably should run
cordova run android or grunt emulate:android
First part with cordova CLI should run all the time, and no need to use Grunt to launch application, if all assets are prepared.
Grunt part is just a guess work based on how I would organize Gruntfile.js and I could be wrong here. Without seeing more details, hard to tell you more.