Quasar: Unable to build with capacitor

Created on 9 Apr 2020  路  7Comments  路  Source: quasarframework/quasar

Describe the bug

I was building app for android by following tutorial and having a trouble with android studio.

To Reproduce

  1. Follow the tutorial until step 2. https://quasar.dev/quasar-cli/developing-capacitor-apps/preparation#2.-Add-Capacitor-Quasar-Mode

  2. Move to step 3, and type. $ quasar dev -m capacitor -T android

  3. "Cannot open C:\Program" error has been thrown which reported in https://github.com/quasarframework/quasar/issues/5556

    • Able to fix this by editing helpers/open-ide.js

  4. After fixing androidStudioPath error, type $ quasar dev -m capacitor -T android again. Android stuido has opened and Manifest merge failed error has been thrown.
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-44:19 to override.
  • If you go back to 2. above, and type npx cap add android -> open android studio manually didn't throw the error. And able to build SPA.

Expected behavior

  • Error should not be thrown when following the tutorial.

Screenshots

image

Platform (please complete the following information):
OS: Windows 10 Pro
Node: 12.16.1
NPM: 6.13.4
Yarn: 1.22.4
Browsers: Firefox
AndroidStudio: 3.6.2

bug

Most helpful comment

https://github.com/quasarframework/quasar/issues/6790

I fixed it by
1.In AndroidManifest.xml replace android:name="android.support.v4.content.FileProvider" with android:name="androidx.core.content.FileProvider"

  1. In gradle.properties file add
    android.useAndroidX=true
    android.enableJetifier=true

All 7 comments

Can confirm, I've also been receiving this error. Fixing the open-ide file also worked for opening Android Studio.

Enabling androidX worked for the manifest error, but caused the app not to boot up. Will try using npx now.

I reviewed some commits. The open package for opening AndroidStudio was updated, and fixed one of it's own bugs which involved the use of double-quotes for paths.

So, I guess, the fix for this is to just remove the double quotes from open-ide.js

EDIT:

Found Capacitor shifted to using Android X. Building the app inside of Android Studio as an Android X project works, and removes the manifest error. Seems to be the cause?

To build as Android X in Android Studio:

Top Menu > Refactor > Migrate to Android X

https://github.com/ionic-team/capacitor/releases

@Dinwy

Fix will be available in "@quasar/app" v1.7.0

https://github.com/quasarframework/quasar/issues/6790

I fixed it by
1.In AndroidManifest.xml replace android:name="android.support.v4.content.FileProvider" with android:name="androidx.core.content.FileProvider"

  1. In gradle.properties file add
    android.useAndroidX=true
    android.enableJetifier=true

According to https://ionicframework.com/blog/announcing-capacitor-2-0/ AndroidX is supported in the 2.0 release of capacitor.

Now I am not very knowledgeable about this, but I noticed that my package.json has

"dependencies": {
    "@capacitor/android": "^2.1.2",
    "@capacitor/cli": "^1.0.0",
    "@capacitor/core": "^1.0.0"
  }

Which leads me to believe that quasar uses the last 1.X version of capacitor cli to generate the capacitor-project? Would using the latest version to generate the project files help resolve issues like this?

EDIT: found this open PR https://github.com/quasarframework/quasar/pull/6808

@rstoenescu please allow me to ask: what was changed in "@quasar/app" v1.7.0 regarding this issue? I'm running 1.9.4 and have trouble with capacitor "Manifest merger failed".
```$quasar info
Operating System - Linux(5.6.15-1-MANJARO) - linux/x64
NodeJs - 12.17.0

Global packages
NPM - 6.14.5
yarn - 1.22.4
@quasar/cli - 1.0.7
cordova - Not installed

Important local packages
quasar - 1.12.2 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
@quasar/app - 1.9.4 -- Quasar Framework local CLI
@quasar/extras - 1.8.1 -- Quasar Framework fonts, icons and animations
```

I see a lot of activity for app v2, including capacitor upgrades. Should I wait and test again when it is released (or is it still too far from release)? Your insight would be much appreciated :)

It鈥檚 just a few days away.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jean-moldovan picture jean-moldovan  路  3Comments

green-mike picture green-mike  路  3Comments

fnicollier picture fnicollier  路  3Comments

hctpbl picture hctpbl  路  3Comments

xereda picture xereda  路  3Comments