ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚑️
https://capacitorjs.com
MIT License
12.35k stars 1.01k forks source link

bug: build failure at capacitor-cordova-android-plugins:compileDebugJavaWithJavac #2786

Closed MarsupiL closed 4 years ago

MarsupiL commented 4 years ago

Bug Report

I'm running into build failures recently. I tried using local gradle 6.3 and 5.6.2, Android Studio 3.6.2 and 3.6.1, Capacitor 2.0.0 and 2.0.1, invalidated caches, cleaned .idea and .iml under android platform, re-sync'd project with gradle files... not sure where else to look.

Capacitor Version

npx cap doctor output:

Latest Dependencies:
  @capacitor/cli: 2.0.1
  @capacitor/core: 2.0.1
  @capacitor/android: 2.0.1
  @capacitor/electron: 2.0.1
  @capacitor/ios: 2.0.1
Installed Dependencies:
  @capacitor/electron not installed
  @capacitor/cli 2.0.1
  @capacitor/core 2.0.1
  @capacitor/ios 2.0.1
  @capacitor/android 2.0.1
[success] Android looking great! πŸ‘Œ
  Found 10 Capacitor plugins for ios:
    cordova-plugin-camera (4.1.0)
    cordova-plugin-device (2.0.3)
    cordova-plugin-dialogs (2.0.2)
    cordova-plugin-file (6.0.2)
    cordova-plugin-file-opener2 (3.0.0)
    cordova-plugin-fingerprint-aio (3.0.1)
    cordova-plugin-media-capture (3.0.3)
    cordova-plugin-screen-orientation (3.0.2)
    cordova-plugin-spinnerdialog (1.3.2)
    es6-promise-plugin (4.2.2)
[success] iOS looking great! πŸ‘Œ

Affected Platform(s)

Current Behavior

Failure to build on Android. Several errors related to capacitor-cordova-android-plugins.

Other Technical Details

npm --version output: 6.14.4 node --version output: v10.15.1 Android Studio version: 3.6.2

Other Information

Build output:

Build: failed
API 'variant.getJavaCompiler()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
API 'variantOutput.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'.
capacitor-cordova-android-plugins/src/main/java/org/apache/cordova/camera/CameraLauncher.java
  package android.support.v4.content does not exist
  cannot find symbol method getUriForFile(Activity,String,File)
  cannot find symbol method getUriForFile(Activity,String,File)
capacitor-cordova-android-plugins/src/main/java/org/apache/cordova/camera/CordovaUri.java
  package android.support.v4.content does not exist
capacitor-cordova-android-plugins/src/main/java/org/apache/cordova/camera/FileProvider.java
  package android.support.v4.content does not exist
capacitor-cordova-android-plugins/src/main/java/io/github/pwlin/cordova/plugins/fileopener2/FileProvider.java
  package android.support.v4.content does not exist
capacitor-cordova-android-plugins/src/main/java/de/niklasmerz/cordova/biometric/BiometricActivity.java
  package android.support.annotation does not exist
  package android.support.annotation does not exist
  package android.support.v4.content does not exist
  package android.support.v7.app does not exist
  cannot find symbol class AppCompatActivity
  cannot find symbol class Nullable
  cannot find symbol class NonNull
  method does not override or implement a method from a supertype
  cannot find symbol variable super
  cannot find symbol method setTitle(<null>)
  cannot find symbol method getPackageName()
  cannot find symbol method getResources()
  cannot find symbol method setContentView(int)
  cannot find symbol method getIntent()
  no suitable constructor found for BiometricPrompt(BiometricActivity,Executor,AuthenticationCallback)
  constructor BiometricPrompt.BiometricPrompt(FragmentActivity,Executor,AuthenticationCallback) is not applicable
(argument mismatch; BiometricActivity cannot be converted to FragmentActivity)
constructor BiometricPrompt.BiometricPrompt(Fragment,Executor,AuthenticationCallback) is not applicable
(argument mismatch; BiometricActivity cannot be converted to Fragment)
  cannot find symbol class NonNull
  cannot find symbol class NonNull
  cannot find symbol variable ContextCompat
  cannot find symbol method startActivityForResult(Intent,int)
  method does not override or implement a method from a supertype
  cannot find symbol variable RESULT_OK
  cannot find symbol method finish()
  cannot find symbol variable RESULT_CANCELED
  cannot find symbol method finish()
capacitor-cordova-android-plugins/src/main/java/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java
  cannot find symbol method getUriForFile(Context,String,File)
  cannot find symbol method getUriForFile(Context,String,File)
jcesarmobile commented 4 years ago

Capacitor 2 uses AndroidX, cordova plugins that use android support libraries need to be updated to use the AndroidX equivalent. You can try using jetifier to patch the plugins.

MarsupiL commented 4 years ago

Damn, I thought Capacitor 2 removed the need for jetifier, my bad. Thanks a lot @jcesarmobile

ionitron-bot[bot] commented 2 years ago

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.