Apk file not building using androidjs - javascript

I was learning to build android apps from nodejs using androidjs library.
Official site- https://android-js.github.io/ ,
documentation- https://android-js.github.io/androidjs/
So, I started with sample app provided by its offcial site, source code link- https://github.com/android-js/androidjs/ , install all the necessary packages and follow the procedure provided. But apk file is never built and I got build process exited with code 1 and sign process exited with code 1.
Here is what I got in my console:
{ DEBUG: false,
BUILDER__cwd: '/usr/local/lib/node_modules/androidjs-builder',
PROJECT__cwd: '/home/satnam/AndroidStudioProjects/mywork/story app',
PROJECT__dist: '/home/satnam/AndroidStudioProjects/mywork/story app/dist',
PROJECT__DIST__name: 'dist',
platform: 'linux',
force_replace: true }
app core copied !
Core Modules Copied !
copying user app done.
User data copied
reading /home/satnam/AndroidStudioProjects/mywork/story app/dist/app-debug/AndroidManifest.xml
User assets cleared
package name com.androidjs.mypkg
{ '$': { 'android:name': 'android.permission.INTERNET' } }
{ '$':
{ 'android:name': 'android.permission.WRITE_EXTERNAL_STORAGE' } }
{ '$':
{ 'android:name': 'android.permission.READ_EXTERNAL_STORAGE' } }
android.webkit.PermissionRequest
Done!
AndroidManifest updated!
changing app name /home/satnam/AndroidStudioProjects/mywork/story app/dist/app-debug/res/values/strings.xml
{ _: 'myapp', '$': { name: 'app_name' } }
App Name updated!
Icon updated!
Building...
(node:5860) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 end listeners added. Use emitter.setMaxListeners() to increase limit
I: Using Apktool 2.4.0
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
build process exited with code 1
Build finished!
Sign apk
stderr: provided apk path or file '/home/satnam/AndroidStudioProjects/mywork/story app/dist/app.apk' does not exist
stderr: java.lang.IllegalArgumentException: provided apk path or file '/home/satnam/AndroidStudioProjects/mywork/story app/dist/app.apk' does not exist
stderr:
at at.favre.tools.apksigner.ui.FileArgParser.parseAndSortUniqueFilesNonRecursive(FileArgParser.java:38)
at at.favre.tools.apksigner.SignTool.execute(SignTool.java:63)
stderr:
at at.favre.tools.apksigner.SignTool.mainExecute(SignTool.java:48)
at at.favre.tools.apksigner.SignTool.main(SignTool.java:36)
stderr:
Cmd history for debugging purpose:
-----------------------
sign process exited with code 1
I have tried with my own nodejs app too, but it's giving me same error.
I don't know what to do, I need help building this. I have to submit android project in college but I have a great interest in nodejs, so I want to build android app from node app. In addition, if you know any other method to build android app from node app you can suggest me. Thanks in advance!

It seems that they are currently having an issue
Maybe there are some issues in androidjs-builder#1.0.7.
We'll fix this
issues ASAP, For now you can downgrade to older version 1.0.6 follow
these steps:
npm uninstall -g androidjs-builder
npm install -g androidjs-builder#1.0.6
I have just tested their Getting Started Example and it has worked (androidjs-builder#1.0.6)

This issue has been fixed and also added some new features to the newer version of Android JS 2.0.0.
So let's check it out version 2.0
website: https://android-js.github.io
docs: https://android-js.github.io/docs
repo: https://github.com/android-js/androidjs
npm: https://npmjs.com/package/androidjs

Related

Ionic 4: No emulator images (avds) found

I'm trying to emulate my ionic 4 app into Android Emulator
so I run the command:
sudo ionic cordova emulate android --prod
I get this error:
BUILD SUCCESSFUL in 1s
42 actionable tasks: 42 up-to-date
Built the following apk(s):
/Users/esham/Desktop/magazine-app/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/Users/esham/Library/Android/sdk (DEPRECATED)
No emulator images (avds) found.
1. Download desired System Image by running: /Users/esham/Library/Android/sdk/tools/android sdk
2. Create an AVD by running: /Users/esham/Library/Android/sdk/tools/android avd
HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver
[ERROR] An error occurred while running subprocess cordova.
cordova emulate android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
But I have 3 ADV on ADV Manager!!
And I could run any one of them by terminal for examble emulator #Pixel_2_API_26
These the list of ADV I have: emulator -list-avds
Pixel_2_API_26
Pixel_2_API_28
Pixel_3_API_28
When I'm running command android list avd getting:
The following Android Virtual Devices could not be loaded:
Name: Pixel_3_API_28
Path: /Users/esham/.android/avd/Pixel_3_API_28.avd
Error: Google pixel_3 no longer exists as a device
---------
Name: Pixel_2_API_26
Path: /Users/esham/.android/avd/Pixel_2_API_26.avd
Error: Google pixel_2 no longer exists as a device
---------
Name: Pixel_2_API_28
Path: /Users/esham/.android/avd/Pixel_2_API_28_1.avd
Error: Google pixel_2 no longer exists as a device
So it doesn't make any sense! I have 3 ADV with all supported levels by cordova and keep saying No emulator images (avds) found.
These my environment setup on macOS:
export ANDROID_SDK=$HOME/Library/Android/sdk
export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH
export ANDROID_HOME="$HOME/Library/Android/sdk"
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH/:$ANDROID_HOME/platform-tools
I have solved the issue by adding --emulator=amulator_name
So the full command will be:
ionic cordova emulate android --prod --emulator=Pixel_3_API_28
If you run "ionic cordova run android" it's automatic run emulate by default. so try this. I hope it fixed your issue. firstly you check you Emulated Android path and it is properly downloaded or not. You run "ionic cordova resources" it checks all resources if fine or not. You need to be install anything or not. so try this.

How can I use ffplay from Electron.js app?

I've installed ffplay in my working folder (in bin subfolder) using ffbinaries (ffbinaries downloader). My current platform is linux-64.
I've use:
var spawn = require('child_process').spawn,
player = spawn('./bin/ffplay', ['http://path_to_video_file']);
but got an error in terminal stderr:
./bin/ffplay: error while loading shared libraries: libSDL2-2.0.so.0: cannot open shared object file: No such file or directory child process exited with code : 127
How can I get access from my javascript code to this binary for playing videos or how can I get ready-to-use binary which is a built-in for my Electron app?
...Or how can I get all of ffplay possibilities for playing videos inside Electron app?
Thanks in advance!
The error you get means that ffplay cannot find libSDL.
First, make sure the library is installed by opening a terminal window and typing:
sudo apt install libsdl2-dev
If it wasn't installed, try to run your program again after it was installed.
If you still have the problem, type the following in your terminal window:
export LD_LIBRARY_PATH="/usr/local/lib"
Try again to run your program. If the problem is now solved, edit the file etc/environment and add the setting there to make it permanent:
sudo nano /etc/environment
Add this LD_LIBRARY_PATH="/usr/local/lib" at the end, exit and save.
Hope it helps.

vscode-ripgrep not getting installed in VSCode build/run process

I was trying to build and run VSCode on my Ubuntu 17.10 using the following guide: https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run
When I tried to install dependencies using yarn, it is giving me the following error:
error /home/dhairyakhale/git/vscode/node_modules/vscode-ripgrep: Command failed.
Exit code: 1
Command: node ./lib/postinstall.js
Arguments:
Directory: /home/dhairyakhale/git/vscode/node_modules/vscode-ripgrep
Output:
Unzipping to /home/dhairyakhale/git/vscode/node_modules/vscode-ripgrep/bin
And then it stops the process. How do I proceed?
I have a similar issue while installing Theia. The broken vscode-ripgrep installation caused it. Here is the ticket I submitted to vscode-ripgrep.
https://github.com/roblourens/vscode-ripgrep/issues/15

Service Worker not working with create-react-app

I'm using create-react-app for generating a react.js project. It automatically implements a service-worker for progressive web app funtionality if a production build was made by using the command npm run build.
Two weeks ago everything worked fine and I was able to cache all files with the generated service-worker. But since today I always get errors:
On Chrome: Uncaught (in promise) Error: Request for http://localhost:5000/index.html?_sw-precache=aee80fca0f83208cc4d82ae2ccfda3c1 returned a response with status 301 at service-worker.js:1.
On Firefox: Service worker event waitUntil() was passed a promise that rejected with 'TypeError: NetworkError when attempting to fetch resource.'.
I have absolutely not idea why the error occurs.
Even if I create a new app and don't touch any of the generated files, the error shows up in the browsers console.
Steps to reproduce:
npx create-react-app my-app
cd my-app
npm run build
serve -s build
open app in browser
I tested it on two separate machines but get the same result. Any help is very appreciated.
Edit:
Console output after running npm run build:
C:PATH-TO-PROJECT>npm run build
> frontend#0.1.0 build C:\xampp\htdocs\gitlab\BA\App-PWA-progetraenke.app\frontend
> react-scripts build
Creating an optimized production build...
Compiled successfully.
File sizes after gzip:
164.04 KB build\static\js\main.d2519277.js
781 B build\static\css\main.77261875.css
The project was built assuming it is hosted at the server root.
You can control this with the homepage field in your package.json.
For example, add this to build it for GitHub Pages:
"homepage" : "http://myname.github.io/myapp",
The build folder is ready to be deployed.
You may serve it with a static server:
serve -s build
Find out more about deployment here:
https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#deployment
I had the same issue with a VueJS app I created by using the PWA template of Vue. What did the trick for me was updating to the latest version of vue-cli and serve.
Updating to the latest serve version (8.1.4) probably solved my problem.

Windows 10, existing binding.node file cannot be found when running jest

When running windows 10, on appveyor and as a virtualbox, I'm getting the same, error when running jest tests for my electron app.
The specified module could not be found.
\\?\C:\Users\User\peruse\app\node_modules\ref\build\Release\binding.node
Error: The specified module could not be found.
\\?\C:\Users\User\peruse\app\node_modules\ref\build\Release\binding.node
at Runtime.requireModule (node_modules/jest-runtime/build/index.js:263:31)
at bindings (app/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (app/node_modules/ref/lib/ref.js:5:47)
(https://ci.appveyor.com/project/joshuef/peruse/build/1.0.733/job/fwflo19to9rvt085#L4664)
The thing is... the file itself exists, as confirmed by running:
dir \\?\C:\Users\User\peruse\app\node_modules\ref\build\Release\binding.node
which results in:
-a---- 4/9/2018 1:44 AM 157696 binding.node
And the application itself runs fine (it's an electron app, compiled via webpack). Only when running tests against the native libs do I get this error. And only in windows. (osx/linux tests are running fine.)
I've tried rebuilding, using npm instead of yarn, re-installing vs2017 tools via the command line... I'm consistently getting this error on both systems (which is something), but I'm stumped as to what to try next...
Jest is being run from the command line.
Jest is configured thus:
module.exports = {
verbose : true,
moduleFileExtensions : ['js', 'jsx', 'json'],
setupFiles : ['raf/polyfill','<rootDir>/test/setup.js'],
testPathIgnorePatterns : ['node_modules'],
moduleDirectories : ['app', 'test', 'node_modules', 'app/node_modules'],
moduleNameMapper : {
"electron": "<rootDir>/mocks/electron.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/mocks/fileMock.js",
"\\.(css|scss)$": "<rootDir>/mocks/fileMock.js",
'^appPackage$' : '<rootDir>/package.json',
'^#actions(.*)$' : '<rootDir>/app/actions$1',
'^#components(.*)$' : '<rootDir>/app/components$1',
'^#containers(.*)$' : '<rootDir>/app/containers$1',
'^appConstants$' : '<rootDir>/app/constants.js',
'^#extensions(.*)$' : '<rootDir>/app/extensions$1',
'^#logger$' : '<rootDir>/app/logger.js',
'^#reducers(.*)$' : '<rootDir>/app/reducers$1',
'^#store(.*)$' : '<rootDir>/app/store',
'^#utils(.*)$' : '<rootDir>/app/utils$1'
}
};
the appveyor config file is here.
Any pointers/ideas/things to check super appreciated. If more code clarification could be needed, just let me know.
Thanks in advance!
I had a similar error with ibm_db module on Windows 10 ( but not in a Linux Docker container ):
The specified module could not be found.
\\?\C:\_projects\projectName\node_modules\ibm_db\build\Release\odbc_bindings.node
at Runtime._loadModule (node_modules/jest-runtime/build/index.js:572:29)
at bindings (node_modules/bindings/bindings.js:112:48)
Found the solution here:
Download odbc driver from IBM site. You might need to register
at IBM for this.
Install this odbc driver by simply extracting the
content of the package that you downloaded to some folder, for
examle to "C:\IBMDB2\CLIDRIVER\"
Set IBM_DB_HOME environmental variable pointing to folder with drivers. ( to
"C:\IBMDB2\CLIDRIVER\" if you used that path )
Add "%IBM_DB_HOME%\bin" path in "PATH" env variable.
Restart or Sing out/Sign in so changes to PATH take effect.
Reinstall packages using "npm install" since all those environmental variables are only used during the package installation phase.

Categories