[SOLVED] Ionic 6 + Capacitor: Fresh installation compile error

Hello,
i’ve installed a fresh version of ionic 6 to begin development of a new app.
When i execute this command:
ionic capacitor run android --warning-mode all
app don’t compile.

Here output:


> ng run app:build
✔ Browser application bundle generation complete.
✔ Copying assets complete.
✔ Index html generation complete.

Initial Chunk Files                                                     | Names             |      Size
vendor.js                                                               | vendor            |   4.05 MB
polyfills.js                                                            | polyfills         | 299.44 kB
styles.css                                                              | styles            |  37.09 kB
main.js                                                                 | main              |  22.08 kB
runtime.js                                                              | runtime           |  13.78 kB

                                                                        | Initial Total     |   4.41 MB

Lazy Chunk Files                                                        | Names             |      Size
node_modules_ionic_core_dist_esm_swiper_bundle-28080340_js.js           | -                 | 200.26 kB
polyfills-core-js.js                                                    | polyfills-core-js |  92.34 kB
node_modules_ionic_core_dist_esm_ion-item_8_entry_js.js                 | -                 |  92.11 kB
node_modules_ionic_core_dist_esm_ion-datetime_3_entry_js.js             | -                 |  92.01 kB
node_modules_ionic_core_dist_esm_ion-app_8_entry_js.js                  | -                 |  76.13 kB
node_modules_ionic_core_dist_esm_ion-slide_2_entry_js.js                | -                 |  60.14 kB
node_modules_ionic_core_dist_esm_ion-refresher_2_entry_js.js            | -                 |  50.59 kB
node_modules_ionic_core_dist_esm_ion-segment_2_entry_js.js              | -                 |  40.50 kB
node_modules_ionic_core_dist_esm_ion-menu_3_entry_js.js                 | -                 |  38.83 kB
node_modules_ionic_core_dist_esm_ion-nav_2_entry_js.js                  | -                 |  34.58 kB
node_modules_ionic_core_dist_esm_ion-item-option_3_entry_js.js          | -                 |  34.25 kB
node_modules_ionic_core_dist_esm_ion-button_2_entry_js.js               | -                 |  33.87 kB
node_modules_ionic_core_dist_esm_ion-searchbar_entry_js.js              | -                 |  33.69 kB
node_modules_ionic_core_dist_esm_ion-select_3_entry_js.js               | -                 |  32.77 kB
node_modules_ionic_core_dist_esm_ion-route_4_entry_js.js                | -                 |  29.72 kB
node_modules_ionic_core_dist_esm_ion-range_entry_js.js                  | -                 |  28.25 kB
node_modules_ionic_core_dist_esm_ion-fab_3_entry_js.js                  | -                 |  26.93 kB
node_modules_ionic_core_dist_esm_ion-accordion_2_entry_js.js            | -                 |  26.82 kB
node_modules_ionic_core_dist_esm_ion-tab-bar_2_entry_js.js              | -                 |  23.98 kB
node_modules_ionic_core_dist_esm_ion-breadcrumb_2_entry_js.js           | -                 |  22.26 kB
node_modules_ionic_core_dist_esm_ion-progress-bar_entry_js.js           | -                 |  21.99 kB
node_modules_ionic_core_dist_esm_ion-input_entry_js.js                  | -                 |  21.53 kB
node_modules_ionic_core_dist_esm_ion-picker-internal_entry_js.js        | -                 |  21.33 kB
polyfills-dom.js                                                        | polyfills-dom     |  19.42 kB
node_modules_ionic_core_dist_esm_ion-virtual-scroll_entry_js.js         | -                 |  19.35 kB
node_modules_ionic_core_dist_esm_ion-textarea_entry_js.js               | -                 |  19.25 kB
node_modules_ionic_core_dist_esm_ion-toggle_entry_js.js                 | -                 |  17.70 kB
node_modules_ionic_core_dist_esm_ion-back-button_entry_js.js            | -                 |  17.05 kB
node_modules_ionic_core_dist_esm_ion-radio_2_entry_js.js                | -                 |  16.80 kB
node_modules_ionic_core_dist_esm_input-shims-fef4a5fa_js.js             | -                 |  16.73 kB
node_modules_ionic_core_dist_esm_ion-col_3_entry_js.js                  | -                 |  15.64 kB
node_modules_ionic_core_dist_esm_ion-card_5_entry_js.js                 | -                 |  15.64 kB
node_modules_ionic_core_dist_esm_ion-infinite-scroll_2_entry_js.js      | -                 |  13.94 kB
node_modules_ionic_core_dist_esm_ion-reorder_2_entry_js.js              | -                 |  12.91 kB
node_modules_ionic_core_dist_esm_ion-picker-column-internal_entry_js.js | -                 |  11.95 kB
node_modules_ionic_core_dist_esm_ion-checkbox_entry_js.js               | -                 |  11.47 kB
node_modules_ionic_core_dist_esm_ion-split-pane_entry_js.js             | -                 |  10.13 kB
node_modules_ionic_core_dist_esm_ion-chip_entry_js.js                   | -                 |   9.85 kB
node_modules_ionic_core_dist_esm_ion-tab_2_entry_js.js                  | -                 |   9.71 kB
common.js                                                               | common            |   8.94 kB
src_app_folder_folder_module_ts.js                                      | -                 |   8.37 kB
node_modules_ionic_core_dist_esm_ion-spinner_entry_js.js                | -                 |   8.22 kB
node_modules_ionic_core_dist_esm_ion-ripple-effect_entry_js.js          | -                 |   6.65 kB
node_modules_ionic_core_dist_esm_ion-avatar_3_entry_js.js               | -                 |   5.82 kB
node_modules_ionic_core_dist_esm_tap-click-c0be8677_js.js               | -                 |   5.75 kB
node_modules_ionic_core_dist_esm_keyboard-808e4e15_js.js                | -                 |   5.40 kB
node_modules_ionic_core_dist_esm_ion-img_entry_js.js                    | -                 |   3.59 kB
node_modules_ionic_core_dist_esm_ion-backdrop_entry_js.js               | -                 |   3.47 kB
node_modules_ionic_core_dist_esm_swipe-back-edc455e2_js.js              | -                 |   2.79 kB
node_modules_ionic_core_dist_esm_ion-action-sheet_entry_js.js           | -                 |   2.77 kB
node_modules_ionic_core_dist_esm_ion-loading_entry_js.js                | -                 |   2.74 kB
node_modules_ionic_core_dist_esm_ion-popover_entry_js.js                | -                 |   2.74 kB
node_modules_ionic_core_dist_esm_ion-alert_entry_js.js                  | -                 |   2.73 kB
node_modules_ionic_core_dist_esm_ion-modal_entry_js.js                  | -                 |   2.73 kB
node_modules_ionic_core_dist_esm_ion-toast_entry_js.js                  | -                 |   2.73 kB
node_modules_ionic_core_dist_esm_status-tap-4087b8c4_js.js              | -                 |   2.57 kB
node_modules_ionic_core_dist_esm_ion-text_entry_js.js                   | -                 |   1.76 kB

Build at: 2021-12-30T16:50:22.149Z - Hash: 030df791efe5b247 - Time: 6632ms
> capacitor run android --target H3XDU17317000579
[capacitor] ✔ Copying web assets from www to android/app/src/main/assets/public in 1.63s
[capacitor] ✔ Creating capacitor.config.json in android/app/src/main/assets in 2.74ms
[capacitor] (node:21881) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/develop/Documents/apps/210_grammi/node_modules/tslib/package.json.
[capacitor] Update this package.json to use a subpath pattern like "./*".
[capacitor] (Use `node --trace-deprecation ...` to show where the warning was created)
[capacitor] ✔ copy android in 1.67s
[capacitor] ✔ Updating Android plugins in 7.89ms
[capacitor] [info] Found 4 Capacitor plugins for android:
[capacitor]        @capacitor/app@1.0.7
[capacitor]        @capacitor/haptics@1.1.3
[capacitor]        @capacitor/keyboard@1.2.0
[capacitor]        @capacitor/status-bar@1.0.6
[capacitor] ✔ update android in 89.23ms
[capacitor] ✖ Running Gradle build - failed!
[capacitor] [error] WARNING:: Using flatDirs should be avoided because it doesn't support any meta-data formats.
[capacitor]         Currently detected usages:
[capacitor]         - repository flatDir used in: project ':app', project ':capacitor-cordova-android-plugins'
[capacitor]         WARNING:: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
[capacitor]         This repository is deprecated and it will be shut down in the future.
[capacitor]         See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
[capacitor]         Currently detected usages in: root project 'android', project ':app', project ':capacitor-android', ...
[capacitor]         > Task :app:preBuild UP-TO-DATE
[capacitor]         > Task :app:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-android:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-android:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-android:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-app:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-app:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-app:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-cordova-android-plugins:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-haptics:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-keyboard:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-status-bar:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:compileDebugAidl NO-SOURCE
[capacitor]         > Task :app:compileDebugAidl NO-SOURCE
[capacitor]         > Task :capacitor-android:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-app:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-cordova-android-plugins:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-haptics:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-keyboard:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-status-bar:packageDebugRenderscript NO-SOURCE
[capacitor]         > Task :app:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :app:generateDebugBuildConfig UP-TO-DATE
[capacitor]         > Task :app:javaPreCompileDebug UP-TO-DATE
[capacitor]         > Task :capacitor-android:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-app:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:writeDebugAarMetadata
[capacitor]         > Task :capacitor-keyboard:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :app:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :app:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-android:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-android:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :capacitor-android:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-android:packageDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-app:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-app:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :capacitor-app:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-app:packageDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-cordova-android-plugins:generateDebugResValues
[capacitor]         > Task :capacitor-cordova-android-plugins:generateDebugResources
[capacitor]         > Task :capacitor-cordova-android-plugins:packageDebugResources
[capacitor]         > Task :capacitor-haptics:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-haptics:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:packageDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-keyboard:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:packageDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:compileDebugRenderscript NO-SOURCE
[capacitor]         > Task :capacitor-status-bar:generateDebugResValues UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:generateDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:packageDebugResources UP-TO-DATE
[capacitor]         > Task :app:mergeDebugResources UP-TO-DATE
[capacitor]         > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
[capacitor]         > Task :app:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-android:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-android:processDebugManifest UP-TO-DATE
[capacitor]         > Task :capacitor-app:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-app:processDebugManifest UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:extractDeepLinksDebug
[capacitor]         > Task :capacitor-haptics:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:processDebugManifest UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:processDebugManifest UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:extractDeepLinksDebug UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:processDebugManifest
[capacitor]         > Task :capacitor-status-bar:processDebugManifest UP-TO-DATE
[capacitor]         > Task :capacitor-android:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-android:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-android:generateDebugRFile UP-TO-DATE
[capacitor]         > Task :capacitor-app:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-app:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-app:generateDebugRFile UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:compileDebugLibraryResources
[capacitor]         > Task :app:processDebugMainManifest UP-TO-DATE
[capacitor]         > Task :app:processDebugManifest UP-TO-DATE
[capacitor]         > Task :app:processDebugManifestForPackage UP-TO-DATE
[capacitor]         > Task :app:checkDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:parseDebugLocalResources
[capacitor]         > Task :capacitor-haptics:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:generateDebugRFile
[capacitor]         > Task :capacitor-haptics:generateDebugRFile UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:generateDebugRFile UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:generateDebugRFile UP-TO-DATE
[capacitor]         > Task :capacitor-android:generateDebugBuildConfig UP-TO-DATE
[capacitor]         > Task :capacitor-android:javaPreCompileDebug UP-TO-DATE
[capacitor]         > Task :capacitor-android:compileDebugJavaWithJavac FAILED
[capacitor]         
[capacitor]         FAILURE: Build failed with an exception.
[capacitor]         
[capacitor]         * What went wrong:
[capacitor]         Execution failed for task ':capacitor-android:compileDebugJavaWithJavac'.
[capacitor]         > java.lang.NullPointerException (no error message)
[capacitor]         
[capacitor]         * Try:
[capacitor]         Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[capacitor]         
[capacitor]         * Get more help at https://help.gradle.org
[capacitor]         
[capacitor]         Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[capacitor]         Use '--warning-mode all' to show the individual deprecation warnings.
[capacitor]         See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings
[capacitor]         
[capacitor]         BUILD FAILED in 2s
[capacitor]         61 actionable tasks: 9 executed, 52 up-to-date
[capacitor]         
[ERROR] An error occurred while running subprocess capacitor.
        
        capacitor run android --target H3XDU17317000579 exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.

I’ve googled but i not found any response.

Can you help me ?

Thanks a lot

Seems a gradle version problem. Try gradle 7.0

Can you paste the output from the command ionic info ?

I solved the issue.
I’ve compiled with Android Studio and now work all.

Thanks