I have tried to build my app and I am receiving an error. I am using:
ionic cordova build android
node version: 12.13.0
Error Below
C:\Users\ville\Documents\gobus-hibrido>ionic cordova build android --verbose
ionic:lib Terminal info: { ci: false, shell: 'C:\\WINDOWS\\system32\\cmd.exe', tty: true, windows: true } +0ms
ionic:lib CLI global options: { _: [ 'cordova', 'build', 'android' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +4ms
ionic:lib:project Project type from config: Ionic 1 (ionic1) +0ms
ionic:lib:project Project details: { configPath: 'C:\\Users\\ville\\Documents\\gobus-hibrido\\ionic.config.json', errors: [], context: 'app', type: 'ionic1' } +1ms
ionic Context: { binPath: 'C:\\Users\\ville\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath: 'C:\\Users\\ville\\AppData\\Roaming\\npm\\node_modules\\ionic', execPath: 'C:\\Users\\ville\\Documents\\gobus-hibrido', version: '5.4.4' } +0ms
ionic:lib:integrations:cordova:config Loading Cordova Config (config.xml: 'C:\\Users\\ville\\Documents\\gobus-hibrido\\config.xml', package.json: 'C:\\Users\\ville\\Documents\\gobus-hibrido\\package.json') +0ms
ionic:lib:build build options: {
ionic:lib:build '--': [],
ionic:lib:build engine: 'cordova',
ionic:lib:build platform: 'android',
ionic:lib:build project: undefined,
ionic:lib:build verbose: false,
ionic:lib:build type: 'ionic1'
ionic:lib:build } +0ms
ionic:lib:telemetry Sending telemetry for command: 'ionic cordova build' [ 'android', '--verbose', '--interactive', '--color' ] +0ms
ionic:lib:hooks Looking for ionic:build:before npm script. +0ms
ionic:lib:build Looking for ionic:build npm script. +8ms
ionic-v1.cmd build
ionic:v1-toolkit:lib:gulp Using gulpfile: C:\Users\ville\Documents\gobus-hibrido\gulpfile.js +0ms
ionic:v1-toolkit:lib:gulp Using gulp: C:\Users\ville\Documents\gobus-hibrido\node_modules\gulp\index.js +4ms
[11:20:02] Cannot load gulp: ReferenceError: primordials is not defined
ionic:v1-toolkit:lib:gulp Using gulpfile: C:\Users\ville\Documents\gobus-hibrido\gulpfile.js +155ms
ionic:v1-toolkit:lib:gulp Using gulp: C:\Users\ville\Documents\gobus-hibrido\node_modules\gulp\index.js +1ms
[11:20:02] Cannot load gulp: ReferenceError: primordials is not defined
[11:20:02] Cannot run sass task: missing in gulpfile.js
ionic:v1-toolkit:lib:gulp Using gulpfile: C:\Users\ville\Documents\gobus-hibrido\gulpfile.js +4ms
ionic:v1-toolkit:lib:gulp Using gulp: C:\Users\ville\Documents\gobus-hibrido\node_modules\gulp\index.js +1ms
[11:20:02] Cannot load gulp: ReferenceError: primordials is not defined
ionic:lib:hooks Looking for ionic:build:after npm script. +461ms
cordova.cmd build android --verbose
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --verbose exited with exit code 1.
Please downgrade / switch to NodeJS 10, this is a known issue with NodeJS 12 and specific dependencies. Or dleete the lockfile (package-lock.json) and try it again.
Related
I'm in a process of upgrading React Native from 0.61.5 to 0.64.2 and I have a problem running the Android app.
This is the output I get when trying to start it:
$ react-native run-android --verbose
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:14959) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
Jetifier found 1313 file(s) to forward-jetify. Using 12 workers...
info JS server already running.
info Installing the app...
debug Running command "cd android && ./gradlew installDebug -PreactNativeDevServerPort=8081"
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: spawn ./gradlew ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:465:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
My Android environment is configured, and I can actually run the exact same command that react-native runs, and it works without the issue:
$ cd android && ./gradlew installDebug -PreactNativeDevServerPort=8081
<-------------> 0% CONFIGURING [7s]
> root project > Resolve dependencies of :classpath > maven-metadata.xml
(gradle eventually finishes the build with a success).
Permissions for gradlew seem ok:
$ ls -la ./android/gradlew
-rwxr-xr-x 1 mateusz 139652859 5766 20 Jul 13:44 ./android/gradlew
gradle-wrapper.properties looks as follows:
$ cat android/gradle/wrapper/gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
React Native CLI is up-to-date:
$ react-native --version
react-native-cli: 2.0.1
react-native: 0.64.2
I found several people had a similar problem but none of them to be exactly the same.
Things work fine on the main branch which still uses 0.61.5. I suspect it may be just me not updating some config file, however I have no idea how to get some more verbose hint on what exactly I have to change.
Any ideas? Thanks!
Turns out react-native was looking for gradlew in a wrong directory!
It looked for it in android/myApp, whereas it should be just android/.
What fixed the issue was a config change in react-native.config.js:
What I had before:
const android = require('#react-native-community/cli-platform-android');
module.exports = {
platforms: {
android: {
linkConfig: android.linkConfig,
projectConfig: android.projectConfig,
dependencyConfig: android.dependencyConfig,
},
},
project: {
android: {
sourceDir: './android/myApp',
stringsPath: './src/main/res/values/strings.xml',
manifestPath: './src/main/AndroidManifest.xml',
buildGradlePath: './build.gradle',
settingsGradlePath: '../settings.gradle',
assetsPath: './src/main/assets',
mainFilePath: './src/main/java/com/company/myapp/MyApp.java',
},
},
};
What I have now (it works):
const android = require('#react-native-community/cli-platform-android');
module.exports = {
platforms: {
android: {
linkConfig: android.linkConfig,
projectConfig: android.projectConfig,
dependencyConfig: android.dependencyConfig,
},
},
project: {
android: {
sourceDir: './android',
stringsPath: './myApp/src/main/res/values/strings.xml',
manifestPath: './myApp/src/main/AndroidManifest.xml',
buildGradlePath: './build.gradle',
settingsGradlePath: './settings.gradle',
assetsPath: './myApp/src/main/assets',
mainFilePath: './myApp/src/main/java/com/company/myapp/MyApp.java',
},
},
};
I am currently on a project developed width Ionic4 and Capacitor.
I want, when building my project on a smartphone (Android), get the source-map files ".ts".
For now, I only have the source-map files ".scss" and ".html".
Here are all the tests of build that I tried
package.json
"scripts": {
"android": "npx cap copy && npx cap open android", // And sync if necessary
"build_1: "ng build && npm run android",
"build_2: "ng build --sourceMap && npm run android",
"build_3: "ionic build && npm run android",
"build_4: "ionic build --source-map && npm run android",
}
I also tried to add this
"config": {
"ionic_generate_source_map": "true",
"ionic_source_map_type": "inline-source-map" // Or eval-source-map
}
Then, finding no solution, I tried webpack.
Inside package.json
"config": {
"ionic_webpack": "./webpack.config.js"
}
Inside webpack.config.js
const process = require('process');
const useDefaultConfig = require('#ionic/app-scripts/config/webpack.config.js');
const env = process.env.IONIC_ENV;
if (env === 'dev' || env === 'development') {
useDefaultConfig[env].devtool = 'inline-source-map';
}
module.exports = () => useDefaultConfig;
Then, once the compilation is finished, I launch the project with Android Studio.
I inspect the sources with Chrome inspect and I only get the sources of the "html" and "scss" files, but not "TypeScript".
Does anyone have a magic idea ?
Config info
Ionic:
Ionic CLI : 5.2.4
Ionic Framework : #ionic/angular 4.7.4
#angular-devkit/build-angular : 0.13.9
#angular-devkit/schematics : 7.3.9
#angular/cli : 7.3.9
#ionic/angular-toolkit : 1.4.1
Capacitor:
Capacitor CLI : 1.1.1
#capacitor/core : 1.1.1
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (0 plugins total)
Utility:
cordova-res : not installed
native-run : 0.2.7
System:
Android SDK Tools : 26.1.1 (C:\Users\xxxxx\AppData\Local\Android\Sdk)
NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
npm : 6.10.3
OS : Windows 10
tsconfig.json
...
"lib": ["dom", "es6"],
"module": "es6",
"target": "es6",
"sourceMap": true
...
I found a solution to my problem.
I use the command npm run build_r define in package.json
scripts: {
"build_r": "ionic capacitor run android --source-map --livereload"
}
below which allows me to access the source-map
I'd been using appcelerator CLI for a while and everything is working, until today.
Suddenly when i try to run the following command, an error occur:
appc ti build --platform android -T device
C:\Users\User\.appcelerator\install\5.0.2\package\node_modules\appc-cli-titanium\node_modules\titanium\node_modules\longjohn\dist\longjohn.js:185
throw e;
^
TypeError: Invalid Version: build.0.0
I tried to search and found that there are a lot of post regarding the longjohn.js throwing e as error, but none of them is having the error message Invalid Version: build.0.0
I'm running this from Windows 7, using appcelerator 5.0.2. Targetted android platform
Anyone encountered this issue before? Any suggestion or steps to fix this?
Thank you
UPDATE
Tried to run appc info and got the following error:
Appcelerator Command-Line Interface, version 5.0.2
Copyright (c) 2014-2015, Appcelerator, Inc. All Rights Reserved.
[PLUGIN-LOAD] 0ms C:\Users\User\.appcelerator\install\5.0.2\package\appc.js
[PLUGIN-LOAD] 776ms C:\Users\User\.appcelerator\install\5.0.2\package\node_modules\appc-cli-titanium\appc.js
[PLUGIN-LOAD] 0ms C:\Users\User\.appcelerator\install\5.0.2\package\node_modules\arrow\appc.js
ERROR | titanium exited with exit code 8. re-run with -l trace to get detailed output
I tried appc ti clean but it doesn't help as well.
UPDATE with -l trace
Below is the result i got running appc info -l trace:
Appcelerator Command-Line Interface, version 5.0.2 Copyright (c) 2014-2015, Appcelerator, Inc. All Rights Reserved.
__command__ search paths: [ "C:\\Users\\User\\.appcelerator\\install\\5.0.2\\package", "C:\\Users\\User\\.appcelerator\\install\\5.0.2\\package\\node_modules", "D:\\appcelerator_workspace\\BlackButton\\modules", "D:\\appcelerator_workspace\\BlackButton\\plugins", "D:\\appcelerator_workspace\\BlackButton\\node_modules", "D:\\appcelerator_workspace\\node_modules", "D:\\node_modules", "C:\\Users\\User\\.appcelerator\\.npm\\lib\\node_modules" ] [PLUGIN-LOAD] 0ms C:\Users\User\.appcelerator\install\5.0.2\package\appc.js [PLUGIN-LOAD] 718ms C:\Users\User\.appcelerator\install\5.0.2\package\node_modules\appc-cli-titanium\appc.js [PLUGIN-LOAD] 1ms C:\Users\User\.appcelerator\install\5.0.2\package\node_modules\arrow\appc.js log level set to "trace" executing command "info" set environment to {"registry":"https://software.appcelerator.com","security":"https://security.appcelerator.com","baseurl":"https://platform.appcelerator.com"}
checking credentials for existing session Attempting to load session info from config file check if session is invalidated session expiry 1449554288096 false Arrow Cloud config file: C:\Users\User\.acs found Arrow Cloud login { mid: 'ce9aca6f8de18937ab3063f00c6ea0c8e194c0ef', publishPort: 443, publishHost: 'https://admin.cloudapp-enterprise.appcelerator.com', username: 'williamtan89#hotmail.com', cookie: [ 'connect.sid=s%3A96v7wP3oaYbdV%2BLKu8IdiE3d.cjDf28RzrGOHQbxcd5507u4R STiRnGEO2SvwCG0zNtw; Path=/; Expires=Tue, 15 Dec 2015 05:58:21 GMT; HttpOnly' ],
defaultEP: { publishHost: 'https://admin.cloudapp-enterprise.appcelerator.com',
publishPort: 443 } } , checking nodeACSEndpoint= https://admin.cloudapp-enterprise.appcelerator.com Arrow Cloud cookie expiry [ 1450159101000 ] session already loaded in opts.session getCredentials() session: { "ipaddress": "10.238.179.133", "username": "williamtan89#hotmail.com", "password": "<OMITTED>", "session": "<OMITTED>", "nonce": "<OMITTED>", "environment": {
"name": "production",
"isProduction": true,
"acsBaseUrl": "https://api.cloud.appcelerator.com",
"acsAuthBaseUrl": "https://secure-identity.cloud.appcelerator.com",
"nodeACSEndpoint": "https://admin.cloudapp-enterprise.appcelerator.com" }, "token": "<OMITTED>", "fingerprint": "ce9aca6f8de18937ab3063f00c6ea0c8e194c0ef", "fingerprint_description": "Windows Machine ID: b250f9d4-0356-48cd-b9fb-d67ac86e7802", "org_id": 100032901, "expiry": 1449554288096 } noPlugins set for command "info" executing command "info" with no plugins "C:\Program Files\nodejs\node.exe" "C:\Users\User\.appcelerator\install\5.0.2\package\node_modules\appc-cli-titanium\node_modules\titanium\bin\titanium" sdk -o json checking for titanium, result: { activeSDK: '5.0.2.GA', defaultInstallLocation: 'C:\\ProgramData\\Titanium', installLocations: [ 'C:\\ProgramData\\Titanium',
'C:\\Users\\User\\AppData\\Roaming\\Titanium',
'C:\\ProgramData\\Application Data\\Titanium' ], installed: { '5.0.2.GA': 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\5.0.2.GA',
'5.0.0.v20150920231514': 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\5.0.0.v20150920231514',
'4.1.1.v20150816214206': 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\4.1.1.v20150816214206',
'3.2.3.GA': 'C:\\Users\\User\\AppData\\Roaming\\Titanium\\mobilesdk\\win32\\3.2.3.GA' }, sdks: { '5.0.2.GA':
{ name: '5.0.2.GA',
manifest: [Object],
path: 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\5.0.2.GA' },
'5.0.0.v20150920231514':
{ name: '5.0.0.v20150920231514',
manifest: [Object],
path: 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\5.0.0.v20150920231514' },
'4.1.1.v20150816214206':
{ name: '4.1.1.v20150816214206',
manifest: [Object],
path: 'C:\\ProgramData\\Titanium\\mobilesdk\\win32\\4.1.1.v20150816214206' },
'3.2.3.GA':
{ name: '3.2.3.GA',
manifest: [Object],
path: 'C:\\Users\\User\\AppData\\Roaming\\Titanium\\mobilesdk\\win32\\3.2.3.GA' } } } cmd [ '/s', '/c', 'node', 'C:\\Users\\User\\.appcelerator\\install\\5.0.2\\package\\node_modules\\appc-cli-titanium\\node_modules\\titanium\\bin\\titanium', 'info', '--color', '--config', '{"cli":{"colors":true}}' ] Titanium Command-Line Interface, CLI version 5.0.4, Titanium SDK version 5.0.2.GA Copyright (c) 2012-2015, Appcelerator, Inc. All Rights Reserved.
Please report bugs to http://jira.appcelerator.org/
8
ERROR | Error: titanium exited with exit code 8. re-run with -l trace to get detailed output
at ChildProcess.<anonymous> (C:\Users\User\.appcelerator\install\5.0.2\package\lib\commands\info.js:35:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
Please clean your project and build it again.
When I run my app on my android device after I have updated cordova plugins I get:
In the cli:
Result: 1
sim-android:
cordova -d run android
cordova library for "android" already exists. No need to download. Continuing.
Calling plugman.prepare for platform "android"
Error: ENOENT, no such file or directory '/home/robin/NetBeansProjects/local/plugins/org.apache.cordova.file'
at Object.fs.statSync (fs.js:684:18)
at /usr/lib/node_modules/cordova/node_modules/plugman/src/prepare.js:124:15
Preparing android project
Processing configuration changes for plugins.
Iterating over installed plugins: [ 'org.apache.cordova.device',
'org.apache.cordova.splashscreen',
'org.apache.cordova.file',
'org.apache.cordova.console',
'org.apache.cordova.battery-status',
'org.apache.cordova.contacts',
'org.apache.cordova.geolocation', at Array.forEach (native)
at Object.handlePrepare (/usr/lib/node_modules/cordova/node_modules/plugman/src/prepare.js:122:24)
at /usr/lib/node_modules/cordova/src/prepare.js:93:25
at _fulfilled (/usr/lib/node_modules/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/usr/lib/node_modules/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/usr/lib/node_modules/cordova/node_modules/q/q.js:760:13)
at /usr/lib/node_modules/cordova/node_modules/q/q.js:821:14
'org.apache.cordova.network-information', at flush (/usr/lib/node_modules/cordova/node_modules/q/q.js:108:17)
'org.apache.cordova.globalization',
'org.apache.cordova.device-motion',
'org.apache.cordova.dialogs',
'org.apache.cordova.device-orientation',
'org.apache.cordova.media',
'org.apache.cordova.media-capture' ]
/home/robin/NetBeansProjects/local/nbproject/build.xml:272: exec returned: 1
BUILD FAILED (total time: 11 seconds)
Updating the plugins is the only thing that has been updated for the build to fail.
This is my plugins.properties file.
org.apache.cordova.AudioHandler=https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git
org.apache.cordova.geolocation=https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
org.apache.cordova.console=https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
Any help with this would be great, thanks.
I have phonegap 3.2.0-0.17.0 installed on Ubuntu 12.10.
For some reason, when I try to build the android platform to my local project on phonegap, I get the following error:
> phonegap local build android
[phonegap] adding the Android platform...
[error] An error occured during creation of android sub-project. Looks like your environment fully supports cordova-android development!
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.package.project_name
Name: project_name
Android target: android-17
Building cordova-3.2.0.jar
{ [Error: Command failed:
BUILD FAILED
/path/to/adt-bundle-linux-x86_64-20131030/sdk/tools/ant/build.xml:653: The following error occurred while executing this line:
/path/to/adt-bundle-linux-x86_64-20131030/sdk/tools/ant/build.xml:698: null returned: 127
Total time: 1 second
] killed: false, code: 1, signal: null }
Here my JAVA_HOME, ANT_HOME & PATH configuration for any suggestion:
export JAVA_HOME=/usr/lib/jvm/default-java
export ANT_HOME=/usr/local/apache-ant-1.9.2
export PATH=${PATH}:/path/to/adt-bundle-linux-x86_64-20131030/sdk/platform-tools:/path/to/adt-bundle-linux-x86_64-20131030/sdk/tools:${ANT_HOME}/bin
Can someone help me to solve this?
Thanks!