Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android - Source and destination must not be the same. #1337

Closed
3 tasks done
jomorr2 opened this issue Sep 4, 2021 · 2 comments
Closed
3 tasks done

Android - Source and destination must not be the same. #1337

jomorr2 opened this issue Sep 4, 2021 · 2 comments

Comments

@jomorr2
Copy link

jomorr2 commented Sep 4, 2021

Bug Report

Problem

Running cordova prepare errors with returns "Source and destination must not be the same"

I also get the error when running cordorva build android and cordova platform add android

What is expected to happen?

cordova prepare completes successfully

What does actually happen?

any cordova android command fails with the error message

Information

I did find this closed bug: #693 and tried the suggestions, but that didn't fix my issue.

Here is the output from cordova prepare --verbose
No scripts found for hook "before_prepare".
Checking for saved platforms that haven't been added to the project
Platform API successfully found in: /Users/jonmorris/CordovaProjects/NWBBASchool/platforms/android/cordova/Api.js
Checking for saved plugins that haven't been added to the project
Generating platform-specific config.xml from defaults for android at /Users/jonmorris/CordovaProjects/NWBBASchool/platforms/android/app/src/main/res/xml/config.xml
Merging project's config.xml into platform-specific android config.xml
[Gradle Properties] Preparing Configuration
[Gradle Properties] Appending default configuration properties
[Gradle Properties] Updating Gradle property "android.useAndroidX" with the value of "false"
[Gradle Properties] Updating Gradle property "android.enableJetifier" with the value of "false"
[Gradle Properties] Appending custom configuration properties
[Gradle Properties] Detected Gradle property "android.useAndroidX" with the value of "true", Cordova's recommended value is "false"
[Gradle Properties] Detected Gradle property "android.enableJetifier" with the value of "true", Cordova's recommended value is "false"
[Gradle Properties] Updating and Saving File
Merging and updating files from [www, platforms/android/platform_www] to platforms/android/app/src/main/assets/www
copy www/platforms/ios/build/device/libCordova.a platforms/android/app/src/main/assets/www/platforms/ios/build/device/libCordova.a (updated file)
Source and destination must not be the same.
Error: Source and destination must not be the same.
at Object.checkPathsSync (/Users/jonmorris/CordovaProjects/NWBBASchool/node_modules/fs-extra/lib/util/stat.js:51:11)
at Object.copySync (/Users/jonmorris/CordovaProjects/NWBBASchool/node_modules/fs-extra/lib/copy-sync/copy-sync.js:24:38)
at updatePathWithStats (/Users/jonmorris/CordovaProjects/NWBBASchool/node_modules/cordova-common/src/FileUpdater.js:106:12)
at /Users/jonmorris/CordovaProjects/NWBBASchool/node_modules/cordova-common/src/FileUpdater.js:272:16
at Array.map ()
at Object.mergeAndUpdateDir (/Users/jonmorris/CordovaProjects/NWBBASchool/node_modules/cordova-common/src/FileUpdater.js:270:40)
at updateWww (/Users/jonmorris/CordovaProjects/NWBBASchool/platforms/android/cordova/lib/prepare.js:186:17)
at Api.module.exports.prepare (/Users/jonmorris/CordovaProjects/NWBBASchool/platforms/android/cordova/lib/prepare.js:85:28)
at Api.prepare (/Users/jonmorris/CordovaProjects/NWBBASchool/platforms/android/cordova/Api.js:126:24)
at /Users/jonmorris/.npm-global/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare/platforms.js:59:28

Command or Code

cordova prepare
cordova build android
cordova cordova platform add android

Environment, Platform, Device

cordova is installed on MacOS 11.3.1

Version information

cordova info output:
Cordova Packages:

cli: 10.0.0
    common: 4.0.2
    create: 3.0.0
    lib: 10.0.0
        common: 4.0.2
        fetch: 3.0.1
        serve: 4.0.0

Project Installed Platforms:

android: 9.1.0

Project Installed Plugins:

cordova-open-native-settings: 1.5.5
cordova-plugin-androidx-adapter: 1.1.3
cordova-plugin-canvas2image-updated: 1.2.0
cordova-plugin-compat: 1.2.0
cordova-plugin-customurlscheme: 5.0.2
cordova-plugin-device: 2.0.3
cordova-plugin-file: 6.0.2
cordova-plugin-firebasex: 13.0.1
cordova-plugin-inappbrowser: 5.0.0
cordova-plugin-screen-orientation: 3.0.2
cordova-plugin-splashscreen: 6.0.0
cordova-plugin-statusbar: 2.4.3
cordova-plugin-whitelist: 1.3.5
cordova-plugin-wkwebview-file-xhr: 3.0.0
es6-promise-plugin: 4.2.2

Environment:

OS: macOS 11.3.1 (20E241) (darwin 20.4.0) x64
Node: v12.14.0
npm: 6.13.4

android Environment:

android:

ERROR: Command failed with ENOENT: android list target
spawn android ENOENT

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@jomorr2
Copy link
Author

jomorr2 commented Sep 4, 2021

Deleting and recreating the project, with the same versions of Cordova, platforms and plugins is able to build successfully now.

@breautek
Copy link
Contributor

breautek commented Sep 4, 2021

Source and destination must not be the same

This was a bug inside the fs-extra package if I recall correctly. If you had cordova / cordova-android installed before, it was possible it was installed at the time where the bugged version was the latest version.

When recreating/reinstalling the project (presumeably wiping package-lock and node_modules), when reinstalling NPM will fetch the latest patch which contains the fix.

Deleting node_modules & package-lock.json and then running npm install should yield the same results as well.

@breautek breautek closed this as completed Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants