Add android platform on ionic - ionic-framework

Hello i get the project from http://reactorapps.io/blog/wordpress-api-ionic-app/
now i want add android platfrom , when i use ionic platform add android
i get this error :
D:\downloadionic\reactorApp\reactorApp>ionic platform add android
✗ (node:9956) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Updated the hooks directory to have execute permissions
(node:1316) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Creating android project...
C:\Users\Pouria.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\node_modules\q\q.js:126
throw e;
^
Error: Please install Android target "android-19".
Hint: Run "android" from your command-line to open the SDK manager.
at C:\Users\Pouria.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\lib\check_reqs.js:174:19
at _fulfilled (C:\Users\Pouria.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\node_modules\q\q.js:798:54)
at self.promiseDispatch.done (C:\Users\Pouria.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\node_modules\q\q.js:827:30)
at Promise.promise.promiseDispatch (C:\Users\Pouria.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\node_modules\q\q.js:760:13)
at C:\Users\Pouria.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\node_modules\q\q.js:574:44
at flush (C:\Users\Pouria.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\node_modules\q\q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
Error: C:\Users\Pouria.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\create.bat: Command failed with exit code 1
at ChildProcess.whenDone (C:\Users\Pouria\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:850:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
what i must to do ???

You have to install Android KitKat (4.4.2) (API 19) through the Android SDK Manager.
You can do this by installing Android Studio and accessing the SDK Manager from within it.
Select the packages that you need and hit 'Install'.

Related

Is there any other way That I can run my application

Hi I'm trying to run an application in vs code, when I hit on tns run I get this error "The current application is not compatible with NativeScript CLI 8.2.3.
Run 'ns migrate' to migrate your project to the latest NativeScript version.
Alternatively you may try running it with '--force' to skip this check.".
When I try to run ns migrate I also get this error "Error: spawn git ENOENT
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)".
Note: I did installed NativeScript 8.2.3.
Please help.

Execution failed for task ':app:processReleaseResources'. Failed to execute aapt

I get this error when I deploy my ionic app:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> Failed to execute aapt
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 12s
at ChildProcess.whenDone (C:\Users\KING WOODE\Desktop\testapp\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:160:13)
at maybeClose (internal/child_process.js:943:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:5560) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5560) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
this worked for me
cordova plugin add cordova-android-support-gradle-release
First you need to remove android platform from the project and reinstall the android platform.
remove android platform :
ionic cordova platform rm android
Install android platform :
ionic cordova platform add android
then try to build the project again, if it will not work , try to remove plugins folder and reinstall cordova plugins again.
Have a look at the cordova-android-support-gradle-release plugin. It "aligns various versions of the Android Support libraries specified by other plugins to a specific version."
Some Cordova plugins include Android Support Libraries to faciliate them. Most commonly, these are now included into the Cordova project by specifying them as Gradle dependencies (see the Cordova plugin spec documentation). (…) The problem arises when these plugins specify different versions of the support libraries. This can cause build failures to occur. (…) To resolve these version collisions, this plugin injects a Gradle configuration file into the native Android platform project, which overrides any versions specified by other plugins, and forces them to the version specified in its Gradle file.

ubuntu: can't run ionic app on emulator because android SDK doesn't exist

I'm using ionic2 and when I run app as ionic cordova run android. I got this
error: ERROR running one or more of the platforms: Android SDK not
found. Make sure that it is installed. If it is not at the default
location, set the ANDROID_HOME environment variable. You may not have
the required environment or OS to run this project
although I have android studio and SDK installed and set it in bashrc file as:
export ANDROID_HOME="/home/shimaa/Android/Sdk"
export PATH=${PATH}:/home/shimaa/Android/Sdk/platform-tools:/Development/android-sdk/tools
export PATH=${PATH}:/home/shimaa/android-studio/gradle/gradle-3.2/bin
but when I write android or sdkmanager in terminal I got this error:
No command 'android' found and sdkmanager: command not found
which means that android is not installed although it is installed and I run it.
anyone can tell me the solution ?

ionic build ios command not working

I have walked through the tutorial instructions to set up cordova and ionic. I can successfully run the app in development but get this error when building ios. Any ideas? Tried updating node and cordova.
sudo ionic build ios
Running 'build:before' gulp task before build
[11:16:00] Starting 'clean'...
[11:16:00] Finished 'clean' after 47 ms
[11:16:00] Starting 'build'...
[11:16:00] Starting 'sass'...
[11:16:00] Starting 'html'...
[11:16:00] Starting 'fonts'...
[11:16:00] Starting 'scripts'...
[11:16:00] Finished 'scripts' after 45 ms
[11:16:00] Finished 'html' after 51 ms
[11:16:00] Finished 'fonts' after 54 ms
[11:16:00] Finished 'sass' after 770 ms
[11:16:07] Finished 'build' after 7.18 s
[11:16:07] Starting 'build:before'...
[11:16:07] Finished 'build:before' after 11 μs
• You're trying to build for ios but don't have the platform installed yet.
∆ Installing ios for you.
Installing cordova-plugin-device
Installing cordova-plugin-console
Installing cordova-plugin-whitelist
Installing cordova-plugin-splashscreen
Installing cordova-plugin-statusbar
Installing ionic-plugin-keyboard
Error: Command failed: /bin/sh -c cordova platform add ios
Error: Platform ios already added.
at ChildProcess.exithandler (child_process.js:213:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:821:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:4
69:12)
First of all, it seems you have some issues on ios platform installation, try removing it and adding it back to your development space.
Run command ionic platform remove ios && ionic platform add ios before trying to build for ios.
Second, you need Mac Operating system to build ios apps, as it has dependencies on XCode (A native software) to build.
Third, if you still have the same iussue, then it could be due to a bug discribed here. https://github.com/driftyco/ionic-cli/issues/772
Try sudo npm install -g cordova and rerun the build.
Good luck.

Can't use plugins for Cordova

Everytime I want to use a plugin I can't build a project and get this error:
$ cordova emulate ios
Generating config.xml from defaults for platform "ios"
Preparing ios project
Running on emulator for platform "ios" via command "/Users/jakob/Dropbox/Coding/+diplomarbeit/phonegap/rlb_cordova/platforms/ios/cordova/run" --emulator
/Users/jakob/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while emulating/deploying the ios project. ** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
2013-12-31 15:54:27.469 xcodebuild[10583:641b] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3575/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78
Details: Failed to load dependencies output contents from ``/Users/jakob/Dropbox/Coding/+diplomarbeit/phonegap/rlb_cordova/platforms/ios/build/rlb_cordova.build/Debug-iphonesimulator/rlb_cordova.build/Objects-normal/i386/CDVDevice.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “CDVDevice.d” couldn’t be opened because there is no such file." UserInfo=0x7ff3ba0424e0 {NSFilePath=/Users/jakob/Dropbox/Coding/+diplomarbeit/phonegap/rlb_cordova/platforms/ios/build/rlb_cordova.build/Debug-iphonesimulator/rlb_cordova.build/Objects-normal/i386/CDVDevice.d, NSUnderlyingError=0x7ff3ba042590 "The operation couldn’t be completed. No such file or directory"}. User info: {
NSFilePath = "/Users/jakob/Dropbox/Coding/+diplomarbeit/phonegap/rlb_cordova/platforms/ios/build/rlb_cordova.build/Debug-iphonesimulator/rlb_cordova.build/Objects-normal/i386/CDVDevice.d";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, F) [F = <lambda at /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3575/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:168:73>]
Thread: <NSThread: 0x7ff3ba041890>{name = (null), num = 9}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **
The following build commands failed:
CompileC build/rlb_cordova.build/Debug-iphonesimulator/rlb_cordova.build/Objects-normal/i386/CDVDevice.o rlb_cordova/Plugins/org.apache.cordova.device/CDVDevice.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
at ChildProcess.<anonymous> (/Users/jakob/lib/node_modules/cordova/src/emulate.js:67:22)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
I only used the CLI and didn't mess with any config. Here I tried to install the device plugin like:
$ cordova plugin add org.apache.cordova.device
Fetching plugin from "org.apache.cordova.device"...
Starting installation of "org.apache.cordova.device" for android
Preparing android project
org.apache.cordova.device installed on android.
Starting installation of "org.apache.cordova.device" for ios
Preparing ios project
org.apache.cordova.device installed on ios.
Looks not too bad but however I can't build the project. Just when I remove the plugin with:
$ cordova plugin remove org.apache.cordova.device
Anyone else having this issues?
My Versions:
$ npm --version
1.3.14
$ node --version
v0.10.22
$ cordova --version
3.3.1-0.1.2
$ git --version
git version 1.8.3.4 (Apple Git-47)
I had the same problem, and I solved It creating the project with uppercase in the first letter of project name. Yes, it seems incredible, but this was the solution.