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

bug: Adding Android 2 with capacitor 1 makes the build fail #2744

Closed
1 of 4 tasks
plvaldes opened this issue Apr 10, 2020 · 2 comments
Closed
1 of 4 tasks

bug: Adding Android 2 with capacitor 1 makes the build fail #2744

plvaldes opened this issue Apr 10, 2020 · 2 comments

Comments

@plvaldes
Copy link

Bug Report

Capacitor Version

npx cap doctor output:
@capacitor/ios not installed
@capacitor/electron not installed
@capacitor/cli 1.5.0
@capacitor/android 2.0.0
@capacitor/core 1.5.0

Affected Platform(s)

  • Android
  • iOS
  • Electron
  • Web

Current Behavior

I have tried to add Android with the command npx cap add android before updating to capacitor 2. The log shows an error:

✔ Installing android dependencies in 11.46s
✔ Adding native android project in: /Users/pablo.lopez/development/projects/xxx/android in 36.41ms
✔ Syncing Gradle in 5.18s
✔ add in 16.68s
✔ Copying web assets from www to android/app/src/main/assets/public in 712.86ms
✔ Copying native bridge in 2.28ms
✔ Copying capacitor.config.json in 1.54ms
✖ copy: ENOENT: no such file or directory, open '/Users/pablo.lopez/development/projects/xxx/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml'
[error] { [Error: ENOENT: no such file or directory, open '/Users/pablo.lopez/development/projects/xxx/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml']
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path:
   '/Users/pablo.lopez/development/projects/xxx/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml' }
✔ Updating Android plugins in 15.22ms
  Found 0 Capacitor plugins for android:
✔ update android in 48.06ms

After this I run the npx cap open android, and when building from the IDE I get the following error:

> Task :app:processDebugManifest FAILED
/Users/pablo.lopez/development/projects/xxx/android/app/src/main/AndroidManifest.xml:22:18-91 Error:
	Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
	is also present at [androidx.core:core:1.2.0] AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory).
	Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-43:19 to override.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
  	is also present at [androidx.core:core:1.2.0] AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory).
  	Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-43:19 to override. 

FYI this is the dependencies list in package.json file after running npx cap add android:
...
"@capacitor/android": "^2.0.0",
"@capacitor/core": "1.5.0",
...

The CLI is also in version 1.5.0 in the devDependencies list

Expected Behavior

This behavior is fixed when I update to capacitor 2. I guess the issue will appear for those users that add the android platform in version 1.5 of capacitor. After the update, everything is on version 2 and works fine

Sample Code or Sample Application Repo

There's nothing special about the ionic app that I was testing. Just a few simple functionalities

Reproduction Steps

  • Create an ionic app with capacitor enabled (the app I am playing around with was created some weeks ago and it is using ionic 5)
  • ionic build
  • npx cap add android
  • npx cap open android

Other Technical Details

npm --version output:
6.9.0
node --version output:
10.16.3

Other Information

n/a

@jcesarmobile
Copy link
Member

yeah, add was installing latest @capacitor/android, but the template used to create project comes from the CLI, it's been changed to install a version that matches the CLI version, see #2724

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 12, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants