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.

bug: Task :capacitor-cordova-android-plugins:compileDebugJavaWithJavac FAILED

See original GitHub issue

Bug Report

Capacitor Version

$ npx cap doctor

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 3.5.1
  @capacitor/core: 3.5.1
  @capacitor/android: 3.5.1
  @capacitor/ios: 3.5.1

Installed Dependencies:

  @capacitor/ios: not installed
  @capacitor/cli: 3.5.1
  @capacitor/core: 3.5.1
  @capacitor/android: 3.5.1

[success] Android looking great! 👌

Platform(s)

  • Android

Current Behavior

Does not run on Android after installing the File plugin.

> Task :capacitor-cordova-android-plugins:compileDebugJavaWithJavac FAILED
/tmp/myApp/android/capacitor-cordova-android-plugins/src/main/java/org/apache/cordova/file/FileUtils.java:39: error: cannot find symbol
import org.apache.cordova.CordovaPluginPathHandler;
^
symbol:   class CordovaPluginPathHandler
location: package org.apache.cordova

/tmp/myApp/android/capacitor-cordova-android-plugins/src/main/java/org/apache/cordova/file/FileUtils.java:1267: error: cannot find symbol
public CordovaPluginPathHandler getPathHandler() {
^
symbol:   class CordovaPluginPathHandler
location: class FileUtils

/tmp/myApp/android/capacitor-cordova-android-plugins/src/main/java/org/apache/cordova/file/FileUtils.java:1339: error: cannot find symbol
return new CordovaPluginPathHandler(pathHandler);
^
symbol:   class CordovaPluginPathHandler
location: class FileUtils
$ ionic cap run android -l --external

? Which device would you like to target? Pixel 4 API 30 (emulator) (Pixel_4_API_30)
> capacitor sync android
[capacitor] ✔ Copying web assets from dist to android/app/src/main/assets/public in 18.93ms
[capacitor] ✔ Creating capacitor.config.json in android/app/src/main/assets in 1.11ms
[capacitor] [info] Found 1 Cordova plugin for android:
[capacitor]        cordova-plugin-file@7.0.0
[capacitor] ✔ copy android in 128.64ms
[capacitor] ✔ Updating Android plugins in 23.54ms
[capacitor] [info] Found 4 Capacitor plugins for android:
[capacitor]        @capacitor/app@1.1.1
[capacitor]        @capacitor/haptics@1.1.4
[capacitor]        @capacitor/keyboard@1.2.2
[capacitor]        @capacitor/status-bar@1.0.8
[capacitor] [info] Found 1 Cordova plugin for android:
[capacitor]        cordova-plugin-file@7.0.0
[capacitor] ✔ update android in 97.61ms
[capacitor] [info] Sync finished in 0.233s
[WARN] Multiple network interfaces detected!
       
       You will be prompted to select an external-facing IP for the dev server that your device or emulator can access.
       Make sure your device is on the same Wi-Fi network as your computer. Learn more about Live Reload in the docs[1].
       
       To bypass this prompt, use the --public-host option (e.g. --public-host=192.168.1.10). You can alternatively bind
       the dev server to a specific IP (e.g. --host=192.168.1.10).
       
       [1]: https://ion.link/livereload-docs
       
? Please select which IP to use: 192.168.1.10 (wlp1s0)
> vue-cli-service serve
[vue-cli-service]  INFO  Starting development server...
Build finished at 08:40:39 by 0.000s

[vue-cli-service]   App running at:
[vue-cli-service]   - Local:   http://localhost:8100/ 
[vue-cli-service]   - Network: http://192.168.1.10:8100/
[vue-cli-service]   Note that the development build is not optimized.
[vue-cli-service]   To create a production build, run npm run build.
[vue-cli-service] Build finished at 08:40:39 by 0.000s

[INFO] Development server running!
       
       Local: http://localhost:8100
       External: http://192.168.1.10:8100, http://172.20.0.1:8100, http://172.18.0.1:8100, http://172.21.0.1:8100,
       http://172.19.0.1:8100
       
       Use Ctrl+C to quit this process
Build finished at 08:40:39 by 0.000s
No issues found.
[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]         Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
[capacitor]         Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
[capacitor]         Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
[capacitor]         Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
[capacitor]         Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
[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-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-cordova-android-plugins:writeDebugAarMetadata
[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 :app:checkDebugAarMetadata 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-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-cordova-android-plugins:processDebugManifest
[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 :app:processDebugMainManifest UP-TO-DATE
[capacitor]         > Task :app:processDebugManifest UP-TO-DATE
[capacitor]         > Task :app:processDebugManifestForPackage UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:compileDebugLibraryResources
[capacitor]         > Task :capacitor-haptics:compileDebugLibraryResources UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:parseDebugLocalResources UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:parseDebugLocalResources
[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-cordova-android-plugins:generateDebugRFile
[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 UP-TO-DATE
[capacitor]         > Task :app:processDebugResources UP-TO-DATE
[capacitor]         > Task :capacitor-android:bundleLibCompileToJarDebug UP-TO-DATE
[capacitor]         > Task :capacitor-app:generateDebugBuildConfig UP-TO-DATE
[capacitor]         > Task :capacitor-app:javaPreCompileDebug UP-TO-DATE
[capacitor]         > Task :capacitor-app:compileDebugJavaWithJavac UP-TO-DATE
[capacitor]         > Task :capacitor-app:bundleLibCompileToJarDebug UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:generateDebugBuildConfig
[capacitor]         > Task :capacitor-cordova-android-plugins:javaPreCompileDebug
[capacitor]         > Task :capacitor-haptics:generateDebugBuildConfig UP-TO-DATE
[capacitor]         
[capacitor]         > Task :capacitor-cordova-android-plugins:compileDebugJavaWithJavac FAILED
[capacitor]         /tmp/myApp/android/capacitor-cordova-android-plugins/src/main/java/org/apache/cordova/file/FileUtils.java:39: error: cannot find symbol
[capacitor]         import org.apache.cordova.CordovaPluginPathHandler;
[capacitor]         ^
[capacitor]         symbol:   class CordovaPluginPathHandler
[capacitor]         location: package org.apache.cordova
[capacitor]         /tmp/myApp/android/capacitor-cordova-android-plugins/src/main/java/org/apache/cordova/file/FileUtils.java:1267: error: cannot find symbol
[capacitor]         public CordovaPluginPathHandler getPathHandler() {
[capacitor]         ^
[capacitor]         symbol:   class CordovaPluginPathHandler
[capacitor]         location: class FileUtils
[capacitor]         /tmp/myApp/android/capacitor-cordova-android-plugins/src/main/java/org/apache/cordova/file/FileUtils.java:1339: error: cannot find symbol
[capacitor]         return new CordovaPluginPathHandler(pathHandler);
[capacitor]         ^
[capacitor]         symbol:   class CordovaPluginPathHandler
[capacitor]         location: class FileUtils
[capacitor]         Note: Some input files use or override a deprecated API.
[capacitor]         Note: Recompile with -Xlint:deprecation for details.
[capacitor]         Note: /tmp/myApp/android/capacitor-cordova-android-plugins/src/main/java/org/apache/cordova/file/AssetFilesystem.java uses unchecked or unsafe operations.
[capacitor]         Note: Recompile with -Xlint:unchecked for details.
[capacitor]         3 errors
[capacitor]         
[capacitor]         FAILURE: Build failed with an exception.
[capacitor]         
[capacitor]         * What went wrong:
[capacitor]         Execution failed for task ':capacitor-cordova-android-plugins:compileDebugJavaWithJavac'.
[capacitor]         > Compilation failed; see the compiler error output for details.
[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]         BUILD FAILED in 2s
[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]         71 actionable tasks: 11 executed, 60 up-to-date
[capacitor]         
[ERROR] An error occurred while running subprocess capacitor.
        
        capacitor run android --no-sync --target Pixel_4_API_30 exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.

Code Reproduction

ionic start myApp blank --type vue
cd myApp
npm install cordova-plugin-file
npm install @awesome-cordova-plugins/file
ionic cap sync
ionic cap run android -l --external

Other Technical Details

$ ionic info

Ionic:

   Ionic CLI       : 6.19.0 (/home/$USER/.nvm/versions/node/v14.18.3/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/vue 6.1.4

Capacitor:

   Capacitor CLI      : 3.5.1
   @capacitor/android : 3.5.1
   @capacitor/core    : 3.5.1
   @capacitor/ios     : not installed

Utility:

   cordova-res : not installed globally
   native-run  : 1.5.0

System:

   NodeJS : v14.18.3 (/home/$USER/.nvm/versions/node/v14.18.3/bin/node)
   npm    : 8.5.4
   OS     : Linux 5.15
$ java --version

java 11.0.14 2022-01-18 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.14+8-LTS-263)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.14+8-LTS-263, mixed mode)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
vmartinscommented, May 9, 2022

I downgraded cordova-plugin-file from version 7 to 6 and it solved the problem!

npm install cordova-plugin-file@6
3reactions
jcesarmobilecommented, Jul 7, 2022

Capacitor uses cordova-android 7.0.0 by default, as I mentioned, you can change the version used by editing the variables.gradle file that your projects should already have, and change the cordovaAndroidVersion = '7.0.0' to cordovaAndroidVersion = '10.1.1'

Read more comments on GitHub >

github_iconTop Results From Across the Web

capacitor-preferences:compileDebugJavaWithJavac FAILED ...
Task :capacitor-preferences:compileDebugJavaWithJavac FAILED ... error: package android.app does not exist import android.app.Activity;.
Read more >
Unable to create stories, task/bug - Atlassian Community
Solved: I have not been able to create any stories, tasks or bugs in few of my JIRA projects (Company Software ones) Error...
Read more >
JDK-8229385 - Java Bug Database
JDK-8229385 : TestPromotionFailedEventWithParallelScavenge.java failed due to SIGSEGV. Type: Bug; Component: hotspot; Sub-Component: jfr; Affected Version: ...
Read more >
Error:Execution failed for task ':app ... - YouTube
In this android studio video tutorial we will fix an error that normally and usually occur because of adding random or duplicate libraries ......
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