Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Missing cast to FragmentActivity #12

Closed
jakguel opened this issue Feb 23, 2022 · 1 comment
Closed

Missing cast to FragmentActivity #12

jakguel opened this issue Feb 23, 2022 · 1 comment

Comments

@jakguel
Copy link

jakguel commented Feb 23, 2022

Bug Report

Problem

I can't compile my Android Project
Missing cast to Fragment Activity in following two lines :
InAppBrowser.java:385
InAppBrowser.java:1125

Running "ionic cap sync" is successful, but I can't actually compile the android source code

My changes to fix the problem:

InAppBrowser.java
- 385 : popupBridgeClient.deliverPopupBridgeResult(cordova.getActivity());
+ 385 : popupBridgeClient.deliverPopupBridgeResult((FragmentActivity) cordova.getActivity());

- 1125 : popupBridgeClient = new PopupBridgeClient( cordova.getActivity(), inAppWebView, urlScheme);
+ 1125 : popupBridgeClient = new PopupBridgeClient((FragmentActivity) cordova.getActivity(), inAppWebView, urlScheme);

What is expected to happen?

Compile the application and run on emulator

What does actually happen?

ionic cap run android is failing because of 2 syntax errors

Information

Console output :

[capacitor]         > Task :capacitor-cordova-android-plugins:compileDebugJavaWithJavac FAILED
[capacitor]         C:\Users\Jiyan\Documents\Eatura\EaturaMobileNew\android\capacitor-cordova-android-plugins\src\main\java\org\apache\cordova\inappbrowser\InAppBrowser.java:385: error: incompatible types: Activity cannot be converted to FragmentActivity
[capacitor]         popupBridgeClient.deliverPopupBridgeResult(cordova.getActivity());
[capacitor]         ^
[capacitor]         C:\Users\Jiyan\Documents\Eatura\EaturaMobileNew\android\capacitor-cordova-android-plugins\src\main\java\org\apache\cordova\inappbrowser\InAppBrowser.java:1125: error: incompatible types: Activity cannot be converted to FragmentActivity
[capacitor]         popupBridgeClient = new PopupBridgeClient(cordova.getActivity(), inAppWebView, urlScheme);
[capacitor]         ^
[capacitor]         Note: Some input files use or override a deprecated API.
[capacitor]         Note: Recompile with -Xlint:deprecation for details.
[capacitor]         Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
[capacitor]         2 errors
[capacitor]
[capacitor]         FAILURE: Build failed with an exception.

Command or Code

ionic cap run android

Environment, Platform, Device

Android with min SDK > 21

Version information

What are relevant versions you are using?
Ionic Framework, CLI Version 6.18.1
Capacitor
Windows 10, Android Studio

Checklist

  • [ x] I searched for existing GitHub issues
  • [ x] I updated all Cordova tooling to most recent version
  • [ x] I included all the necessary information above
@dpa99c dpa99c closed this as completed in 6639449 Feb 23, 2022
@dpa99c
Copy link
Owner

dpa99c commented Feb 23, 2022

Fix published in v5.0.2

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