question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not able to generate APK file

See original GitHub issue

Bug Report

Problem

I am trying to build and android version of my ionic application. Sadly I am not able to generate an APK file.

I am running the command “ionic cordova build android”. The sub task “cordova.cmd build android” stops with:

config file undefined requested for changes not found at C:\Users\d060445\university\Team Project\Tracktivity\moveit\platforms\android\undefined, ignoring
config file undefined requested for changes not found at C:\Users\d060445\university\Team Project\Tracktivity\moveit\platforms\android\undefined, ignoring
The "path" argument must be of type string. Received type undefined

running “cordova.cmd build android --verbose” shows:

Updating resource files at platforms\android
  copy  resources/android/xml/network_security_config.xml platforms\android\app\src\main\res\xml\network_security_config.xml (updated file)
Prepared android project successfully
The "path" argument must be of type string. Received type undefined
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:112:11)
    at Object.join (path.js:375:7)
    at ConfigKeeper_get [as get] (C:\Users\d060445\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigKeeper.js:45:26)
    at C:\Users\d060445\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:346:51
    at Array.forEach (<anonymous>)
    at is_conflicting (C:\Users\d060445\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:339:17)
    at PlatformMunger.add_config_changes (C:\Users\d060445\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:190:33)
    at C:\Users\d060445\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:112:32
    at _fulfilled (C:\Users\d060445\university\Team Project\Tracktivity\moveit\node_modules\q\q.js:854:54)
    at C:\Users\d060445\university\Team Project\Tracktivity\moveit\node_modules\q\q.js:883:30

I have already tried several times to remove the android platform and add it again to my project, but the issue still persists.

Version of cordova: $ cordova -v 9.0.0 (cordova-lib@9.0.1)

Checklist

  • [ x] I searched for existing GitHub issues
  • [x ] I updated all Cordova tooling to most recent version
  • [ x] I included all the necessary information above

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
josehectorcommented, Aug 7, 2020

I found the error. The problem is with Node version. this piece of code is where error occurs

function recursivelyFindFiles (dir, extension) {
    if (!fs.existsSync(dir) || !extension) return [];

    const files = fs.readdirSync(dir, { withFileTypes: true })
        .map(entry => {
            const item = path.resolve(dir, entry.name);

            if (entry.isDirectory()) return recursivelyFindFiles(item, extension);
            if (path.extname(entry.name) === `.${extension}`) return item;
            return false;
        });

    return Array.prototype.concat(...files)
        .filter(file => file !== false);
}

withFileTypes parameter is only available in Node 10.10.0 version (https://nodejs.org/api/fs.html#fs_fs_readdirsync_path_options) In my case I am using 10.4.0 Node version so this parameter is not available, and for that entry is a string value (entry.name is undefined).

Therefore, updating Node version to 10.10.0 we solve the problem.

I don’t know if this Node version dependency is normal or not, but I didn’t find which Node version dependency is needed with this plugin version.

1reaction
josehectorcommented, Aug 10, 2020

recursivelyFindFiles is located in ProjectBuilder.js (\platforms\android\cordova\lib\builders\ProjectBuilder.js), line 74.

I think it would be a good idea to reflect that required version in package.json

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Studio not generating APK - Stack Overflow
I have a strange problem that just started with an existing Android Studio 2.3. 3 project. The build process is not automatically generating...
Read more >
Different Ways to fix "The APK file does not exist on disk" in ...
Different Ways to fix “The APK file does not exist on disk” in Android Studio · Method 1: Click on the Sync button...
Read more >
How to Generate APK and Signed APK Files in Android Studio
First things first: open up a project file in Android Studio. If you don't have a project file yet, simply create a New...
Read more >
Build and run your app - Android Developers
On Windows or Linux, navigate to File > Settings > Editor > Live Edit. On macOS, navigate to Android Studio > Preferences >...
Read more >
Generate Release APK with ReactNative CLI (Errors Fixed)
This article is an A-Z guide that will help anybody who is new to mobile app development with React-Native-CLI, to build an APK...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found