apk file with a construct two projects exported via Cordova
I open cmd then I reach to my folder with the exported project and when I try to add android using cmd - "cordova platform add android"
I get this:
'Discovered plugin "cordova-custom-config" in config.xml. Adding it to
the project Failed to restore plugin "cordova-custom-config" from
config.xml. You might need to try adding it again. Error: Failed to
fetch plugin cordova-custom-config via registry. Probably this is
either a connection problem, or plugin spec is incorrect. Check your
connection and plugin name/version/URL. Error: cmd: Command failed
with exit code 1 Error output: npm ERR! code ENOGIT npm ERR! No git
binary found in $PATH npm ERR! npm ERR! Failed using git. npm ERR!
Please check if you have git installed and in your PATH.'
Can someone help me?
do this: cordova platform rm android && cordova platform add android
Related
Finally after some years of reviewing questions posted by others it's time to write my first one!
Well, I installed Node.js and Cordova (state of the art) as per instructed in this page, but at the beginning I failed to install either platform (iOS or Android).
After many attempts, I decided to give it a last try and run the cordova platform add ios command once again, and incredibly it worked!
Using cordova-fetch for cordova-ios#^5.0.0
Adding ios project...
Creating Cordova project for the iOS platform:
Path: platforms\ios
Package: io.cordova.hellocordova
Name: HelloCordova
iOS project created with cordova-ios#5.1.1
Plugin 'cordova-plugin-whitelist' found in config.xml... Migrating it to package.json
Discovered saved plugin "cordova-plugin-whitelist". Adding it to the project
Installing "cordova-plugin-whitelist" for ios
Adding cordova-plugin-whitelist to package.json
Then, I tried to run cordova platform add android as well, but it failed as usual:
Using cordova-fetch for cordova-android#^8.0.0
Failed to fetch platform cordova-android#^8.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 4294963214 Error output:
npm WARN helloworld#1.0.0 No repository field.
npm ERR! code EBUSY
npm ERR! syscall rename
npm ERR! path d:\Dropbox\app\node_modules\.staging\android-versions-697b4c50
npm ERR! dest d:\Dropbox\app\node_modules\android-versions
npm ERR! errno -4082
npm ERR! EBUSY: resource busy or locked, rename 'd:\Dropbox\app\node_modules\.staging\android-versions-697b4c50' -> 'd:\Dropbox\app\node_modules\android-versions'
A complete log of the run is available if needed.
Do you have any clue please?
Needless to say I was running the command prompt as administrator, and the C:\Windows\System32 path is already present in the Environment Windows variable.
Thank you,
Fabio
If i see it correctly, u are working in the Dropbox directory. Dropbox may lock files during its sync operation, which interferes with Cordova. Try moving the app to a folder outside of Dropbox.
I have been trying to use Ionics CLI to regenerate all of the icon and splash images. So I had to install IOS and Android platforms, I installed IOS without a hitch, but installing android has been giving me a problem. Here is what I get after I run this line in Terminal. Any help would be appreciated.
ionic cordova platform add android
Discovered plugin "cordova-plugin-email-composer" in config.xml. Adding it to the project
Failed to restore plugin "cordova-plugin-email-composer" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin https://github.com/katzer/cordova-plugin-email-composer.git#0.8.2 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: git+https://github.com/katzer/cordova-plugin-email-composer.git#0.8.2.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Fin/.npm/_logs/2018-05-28T14_07_22_673Z-debug.log
Discovered plugin "com.rjfun.cordova.iad" in config.xml. Adding it to the project
Failed to restore plugin "com.rjfun.cordova.iad" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin com.rjfun.cordova.iad#^2.0.4 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code E404
npm ERR! 404 Not Found: com.rjfun.cordova.iad#^2.0.4
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Fin/.npm/_logs/2018-05-28T14_07_31_437Z-debug.log
Running command: /Users/Fin/fflow/hooks/after_prepare/010_add_platform_class.js /Users/Fin/fflow
Running command: /Users/Fin/fflow/hooks/after_prepare/020_remove_sass_from_platforms.js /Users/Fin/fflow
--save flag or autosave detected
Saving android#~7.0.0 into config.xml file ...
[ERROR] Exception:
--save flag or autosave detected
Saving android#~7.0.0 into config.xml file ...
[ERROR] Exception:
Remove old Platform and then install new Platform
cordova platform remove android
cordova platform add android#7.1.0
I want to use the cordova file transfer plugin. I'm using it through the Ionic-Native transfer module.
The app won't run because there is a transpile error with the file transfer plugin and the file plugin:
transpile started ...
typescript: plugins/cordova-plugin-file-transfer/types/index.d.ts, line: 9
Cannot find type definition file for 'cordova-plugin-file'.
L8: * #param server URL of the server to receive the file, as encoded by encodeURI().
L9: * #param successCallback A callback that is passed a FileUploadResult object.
L10: * #param errorCallback A callback that executes if an error occurs retrieving the FileUploadResult.
I installed #types/cordova-plugin-file through npm, but the app won't run because of duplicate identifiers in the two cordova-plugin-file packages:
transpile started ...
typescript: node_modules/#types/cordova-plugin-file/index.d.ts, line: 376
Duplicate identifier 'PERSISTENT'.
typescript: node_modules/#types/cordova-plugin-file/index.d.ts, line: 377
Duplicate identifier 'TEMPORARY'.
typescript: plugins/cordova-plugin-file/types/index.d.ts, line: 376
Duplicate identifier 'PERSISTENT'.
typescript: plugins/cordova-plugin-file/types/index.d.ts, line: 377
Duplicate identifier 'TEMPORARY'.
What is the right approach here?
As mentioned, it looks like the typings in cordova-plugin-file-transfer are incorrect.
It should be an external module but it is currently a script file (copied from DefinitelyTyped directly).
On the other hand, since cordova-plugin-file already includes its own typings, you don't need to install #types/cordova-plugin-file.
I experienced this issue as well.
However I was able to work around the issue with the following operations:
Setup :
```
Your system information:
Cordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.2.1
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v7.7.4
Xcode version: Xcode 8.2.1 Build version 8C1002
```
Initial Problem :
```
$ ionic build ios
Running 'build:before' npm script before build
> apoc# build /Users/js/dev/apoc-ochem/app_v3/apoc
> ionic-app-scripts build
[01:47:59] ionic-app-scripts 1.2.1
[01:47:59] build dev started ...
[01:47:59] clean started ...
[01:47:59] clean finished in 2 ms
[01:47:59] copy started ...
[01:47:59] transpile started ...
[01:48:04] typescript: plugins/cordova-plugin-file-transfer/types/index.d.ts, line: 9
Cannot find type definition file for 'cordova-plugin-file'.
L8: * #param server URL of the server to receive the file, as encoded by encodeURI().
L9: * #param successCallback A callback that is passed a FileUploadResult object.
L10: * #param errorCallback A callback that executes if an error occurs retrieving the FileUploadResult.
[01:48:04] ionic-app-script task: "build"
[01:48:04] Error: Failed to transpile program
Error: Failed to transpile program
at new BuildError (/Users/js/dev/apoc-ochem/app_v3/apoc/node_modules/#ionic/app-scripts/dist/util/errors.js:16:28)
at /Users/js/dev/apoc-ochem/app_v3/apoc/node_modules/#ionic/app-scripts/dist/transpile.js:102:20
at transpileWorker (/Users/js/dev/apoc-ochem/app_v3/apoc/node_modules/#ionic/app-scripts/dist/transpile.js:68:12)
at Object.transpile (/Users/js/dev/apoc-ochem/app_v3/apoc/node_modules/#ionic/app-scripts/dist/transpile.js:26:12)
at buildProject (/Users/js/dev/apoc-ochem/app_v3/apoc/node_modules/#ionic/app-scripts/dist/build.js:98:78)
at /Users/js/dev/apoc-ochem/app_v3/apoc/node_modules/#ionic/app-scripts/dist/build.js:46:16
npm ERR! Darwin 16.4.0
npm ERR! argv "/Users/js/.nvm/versions/node/v7.7.4/bin/node" "/Users/js/.nvm/versions/node/v7.7.4/bin/npm" "run" "build"
npm ERR! node v7.7.4
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! apoc# build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the apoc# build script 'ionic-app-scripts build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the apoc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs apoc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls apoc
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!
/Users/js/dev/apoc-ochem/app_v3/apoc/npm-debug.log
```
Steps for Work Around:
Remove Platform
Remove Cordova plugin
Rebuild project
Add Platform
Remove cordova-plugin-file-transfer plugin
Rebuild ios project
```
$ cordova plugin rm cordova-plugin-file-transfer
Removing "cordova-plugin-file-transfer"
$ ionic build ios
...
...
[02:01:20] lint finished in 3.70 s
Error: No platforms added to this project. Please use `cordova platform add <platform>`.
$ ionic platforms add ios
Adding ios project...
Creating Cordova project for the iOS platform:
Path: platforms/ios
Package: com.nielssievertsen.apocsocial
Name: apoc social
iOS project created with cordova-ios#4.3.1
Installing "com.synconset.imagepicker" for ios
Installing "cordova-plugin-camera" for ios
Fetching plugin "cordova-plugin-compat" via npm
Installing "cordova-plugin-compat" for ios
Installing "cordova-plugin-console" for ios
Installing "cordova-plugin-device" for ios
Installing "cordova-plugin-device-motion" for ios
Installing "cordova-plugin-facebook4" for ios
Installing "cordova-plugin-googleplus" for ios
Google Sign-In prerequisites
START Running hook to add iOS Keychain Sharing entitlements (required since iOS 10)
Will add iOS Keychain Sharing entitlements to project 'apoc social'
END Running hook to add iOS Keychain Sharing entitlements (required since iOS 10)
Installing "cordova-plugin-media-capture" for ios
Fetching plugin "cordova-plugin-file" via npm
Installing "cordova-plugin-file" for ios
Dependent plugin "cordova-plugin-compat" already installed on ios.
Dependent plugin "cordova-plugin-compat" already installed on ios.
Installing "cordova-plugin-nativestorage" for ios
Installing "cordova-plugin-shake" for ios
Dependent plugin "cordova-plugin-device-motion" already installed on ios.
Installing "cordova-plugin-splashscreen" for ios
Installing "cordova-plugin-statusbar" for ios
Installing "cordova-plugin-whitelist" for ios
Installing "cordova-sqlite-storage" for ios
installing external dependencies via npm
npm install of external dependencies ok
Installing "ionic-plugin-keyboard" for ios
Installing "phonegap-plugin-push" for ios
Discovered plugin "cordova-plugin-file-transfer" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-file-transfer#~1.6.1" via npm
Installing "cordova-plugin-file-transfer" for ios
Dependent plugin "cordova-plugin-file" already installed on ios.
$ cordova plugin rm cordova-plugin-file-transfer
Uninstalling cordova-plugin-file-transfer from ios
Removing "cordova-plugin-file-transfer"
"cordova-plugin-file" is required by (cordova-plugin-media-capture) and cannot be removed (hint: use -f or --force)
"cordova-plugin-compat" is required by (cordova-plugin-camera, cordova-plugin-media-capture) and cannot be removed (hint: use -f or --force)
$ ionic build ios
............
...
** BUILD SUCCEEDED **
```
Looks like the typings in cordova-plugin-file-transfer is incorrect.
It should be an external module but it is currently a script file (copied from DefinitelyTyped directly).
You should file an issue there.
On the other hand, since cordova-plugin-file already includes its own typings, you don't need to install #types/cordova-plugin-file.
It seems the "plugin/" folder is cordova plugins for ionic2, which you may not need to perform typescript compilation,
You can always ignore the index.d.ts by specifying the exclude target from tsconfig.json
For Ionic there is file called tsconfig.build.json
in it compiler option add below parameter.
"skipLibCheck": true
it should look like this
{
"extends": "...anytest....",
"compilerOptions": {
"baseUrl": ".",
"target": "es5",
"skipLibCheck": true
},
"exclude": [
"...your config here..."
]
}
i have error when i run "ionic run android" or "ionic build android" in my ionic 2 app
this is the error i get. i just tryinh to see my app in the emulator of android.
i tried to make new ionic 2 project but it's the same problem.
Running 'build:before' npm script before build
> ionic-hello-world# build C:\Users\Adir\MyApps\tasklist
> ionic-app-scripts build --rollup ./config/rollup.config.js
[20:16:33] ionic-app-scripts 0.0.30
[20:16:33] build prod started ...
[20:16:33] clean started ...
[20:16:33] clean finished in 24 ms
[20:16:33] copy started ...
[20:16:33] ngc started ...
[20:16:33] lint started ...
[20:16:33] copy finished in 182 ms
[20:16:34] lint finished in 770 ms
[20:16:52] ngc finished in 18.71 s
[20:16:52] bundle prod started ...
[20:16:52] bundle prod failed: Could not resolve entry (/app/main.prod.ts)
[20:16:52] Error: Could not resolve entry (/app/main.prod.ts)
at C:\Users\Adir\MyApps\tasklist\node_modules\rollup\dist\rollup.js:8635:28
at process._tickCallback (internal/process/next_tick.js:103:7)
Error running ionic app script "build": Error: Could not resolve entry (/app/main.prod.ts)
npm
ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v6.7.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world# build: `ionic-app-scripts build --rollup ./config/rollup.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world# build script 'ionic-app-scripts build --rollup ./config/rollup.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!
ionic-app-scripts build --rollup ./config/rollup.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Adir\MyApps\tasklist\npm-debug.log
Caught exception:
undefined
Mind letting us know? https://github.com/driftyco/ionic-cli/issues
C:\Users\Adir\MyApps\tasklist>
This has been a common issue lately with ionic and A2 and resolving main.prod.*Try updating you app scripts for the project.
npm install #ionic/app-scripts#latest
Your error message should change after that with what is actually causing your build to crash. If the error message changes please update your question with the new message.
Checkout this out as well for more information on this issue: Ionic forum
Close all ionic folders and serve or lab. And try again, ionic cordova build android.
First of all, Check the version of Android in package.json file.
Now remove platform with this command (ionic cordova platform rm android)
After that addd the platform with this command (ionic cordova platform add
android#6.4.0). Where 7.0.0 is not stable version so use 6.4.0
Now, run this command (ionic cordova run android) or in mac (sudo ionic cordova run android)
Try out below command
$ cordova clean android
$ cordova build android
$ ionic cordova build android
There is a path setup problem in your system.
1st check npm version using CMD: npm -v
If it shows version number then use below code, otherwise 1st setup your npm path, you can use gitbash cmd, nodejs cmd
Try to use
ionic cordova run android
or
ionic cordova platform remove android
ionic cordova run android
If you have MAC system must use sudo like
sudo ionic cordova run android
When I run the ionic build android command, I get the following error:
WARN: ionic.project has been renamed to ionic.config.json, please rename it.
Uh oh! Looks like you're missing a module in your gulpfile:
Cannot find module 'gulp'
Do you need to run `npm install`?
I have already tried running this command:
npm install --save-dev gulp
But I am still getting the same error. Am I missing something here?
You need to install Gulp globally using the following command: npm install --global gulp-cli, as described in the Gulp documentation.
Please try to run the following commands:
npm install -g gulp
npm install