Flutter error in back/forward navigation for webview - swift

I'm trying to navigate on my webview but especially on some sites e.g Twitter, and Instagram it stays stuck (You can see the message in the log section). But it works for google, e.a.
Let's consider that I'm running "loadUrl()" for twitter.com again and again. It can load the site successfully. Then I loaded google.com. After that, I tapped the navigationBack which is running goBack() func. It stucks like in logs. But for vice versa, I can go back to google.com
Here are my code snippets:
Future<void> goToSite(String siteUrl) async {
await _controller.future;
final WebViewRequest request = WebViewRequest(
uri: Uri.parse(url),
method: WebViewRequestMethod.get,
);
await _webController.loadRequest(request);
}
Widget browser() {
return WebView(
initialUrl: 'https://${_urlController.text.toLowerCase()}',
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
if (!_controller.isCompleted) {
_controller.complete(webViewController);
_webController = webViewController;
}
print("web created");
},
onProgress: (int progress) {
print('WebView is loading (progress : $progress%)');
if (progress == 100) {
notify();
}
},
navigationDelegate: (NavigationRequest request) {
print('allowing navigation to $request');
return NavigationDecision.navigate;
},
onPageStarted: (String url) {
print('Page started loading: $url');
},
onPageFinished: (String url) {
print('Page finished loading: $url');
},
gestureNavigationEnabled: true,
backgroundColor: const Color(0x00000000),
);
}
I'm using this method to navigate:
await _webController.goBack();
await _webController.goForward();
When I tapped goBack I got this repetitive error:
[assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
[ProcessSuspension] 0x152efaee0 - ProcessAssertion: Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=10293, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
[assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
[ProcessSuspension] 0x152efaf40 - ProcessAssertion: Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=10293, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
flutter: Page started loading: https://mobile.twitter.com/
[assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
[ProcessSuspension] 0x152efb060 - ProcessAssertion: Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=10294, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
[assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
[ProcessSuspension] 0x152efb0c0 - ProcessAssertion: Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=10294, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
flutter: Page started loading: https://mobile.twitter.com/
I couldn't find the reason. How can I fix this issue?

Related

Flutter app running on web failing with error : app:compileFlutterBuildDebug'

/E:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/method_channel_firestore.dart:112:15: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/utils/exception.dart:14:11: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(exception, stackTrace);
^^^^^^^^^^^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/utils/exception.dart:17:9: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/utils/exception.dart:12:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
Never convertPlatformException(Object exception, StackTrace stackTrace) {
^
FAILURE: Build failed with an exception.
Where:
Script 'E:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'E:\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try:
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.
Get more help at https://help.gradle.org
BUILD FAILED in 36s
Exception: Gradle task assembleDebug failed with exit code 1
getData() async {
CollectionReference userRef = FirebaseFirestore.instance.collection("user");
QuerySnapshot querySnapshot = await userRef.get();
List<QueryDocumentSnapshot> listDocs = querySnapshot.docs;
listDocs.forEach((element) {
print(element);
});
}

Unable to play .m3u8 file with flutter package better player

I have a .m3u8 file that contains information about a video but I am unable to play it using the BetterPlayer Flutter package.
This is my sample code
var dataSource = BetterPlayerDataSource(
BetterPlayerDataSourceType.file,
"/var/mobile/Containers/Data/Application/B0391873-25D4-471A-AB13-05D5FF8701F9/Documents/content.publicId/test.m3u8",
subtitles: null,
headers: {"cookie":"COOKIE_FOR_AWS_CLOUDFRONT_ACCESS"},
liveStream: true
);
But I keep getting this error:
GetDataFromUrl failed: Invalid argument(s): No host specified in URI /var/mobile/Containers/Data/Application/FE19C886-73B8-49C0-A770-6BAEAD354947/Documents/content.publicId/test.m3u8
Failed to load video: Error Domain=CoreMediaErrorDomain Code=-12865
"(null)" [VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception:
PlatformException(VideoError, Failed to load video: The operation
couldn’t be completed. (CoreMediaErrorDomain error -12865.), null,
null)
These are the contents of the .m3u8 file:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:37
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-KEY:METHOD=AES-128, URI="https://PATH_TO_ENCRYPTION_KEY",IV=0x413873f3924c752d99c7083c0c99931c
#EXTINF:36.440000, https://example.com/test_480p_0000.ts
#EXTINF:28.040000, https://example.com/test_480p_0001.ts
#EXTINF:28.360000, https://example.com/test_480p_0002.ts
#EXTINF:29.920000, https://example.com/test_480p_0003.ts
#EXTINF:36.920000, https://example.com/test_480p_0004.ts
#EXTINF:21.040000, https://example.com/test_480p_0005.ts
#EXT-X-ENDLIST

Create a Custom Android Plugin: java.lang.NullPointerException (no error message)

I´m developing this Android application to run on device.
I´m using Ionic and Angular to develop the application.
Now I need to create a custom plugin using Plugman. This plugin should allowed user to authentication using IBM APP ID.
I followed the instructions mention here https://github.com/ibm-cloud-security/appid-clientsdk-android
to create my gradle file.
However, when I run ionic cordova run android --verbose --debug
I get this error
What went wrong:
Execution failed for task :app:processDebugManifest.
java.lang.NullPointerException (no error message)
And I have no clue what could be the root cause. This is my first time I develop a custom plugin.
My suspicious relies on the dependency, but I can not tell what part is causing the issue.
Ionic Framework : #ionic/angular 5.0.7
#angular-devkit/build-angular : 0.803.26
#angular-devkit/schematics : 8.3.26
#angular/cli : 8.3.26
#ionic/angular-toolkit : 2.2.0
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 7 other plugins)
Utility:
cordova-res (update available: 0.14.0) : 0.10.0
native-run (update available: 1.0.0) : 0.3.0
System:
Android SDK Tools : 26.1.1 (C:\\Android\\sdk)
NodeJS : v14.2.0 (C:\Program Files\\nodejs\\node.exe)
npm : 6.14.4
OS : Windows 10```
LOG=======================================
C:\project_cren\plugin\ci-uix-mobile-master>ionic cordova run android --verbose --debug
ionic:lib Terminal info: { ci: false, shell: 'C:\\WINDOWS\\system32\\cmd.exe', tty: false, windows: true } +0ms
ionic:lib CLI global options: { _: [ 'cordova', 'run', 'android' ], help: null, h: null, verbose: true, quiet: null, interactive: false, color: true, confirm: null, json: null, debug: true, project: null, '--': [] } +4ms
ionic:lib:project Project type from config: #ionic/angular (angular) +0ms
ionic:lib:project Project details: { configPath: 'C:\\project_cren\\plugin\\ci-uix-mobile-master\\ionic.config.json', errors: [], context: 'app', type: 'angular' } +1ms
ionic Context: { binPath: 'C:\\Users\\AMANDODOSSANTOSNETO\\AppData\\Roaming\\npm\\node_modules\\#ionic\\cli\\bin\\ionic', libPath: 'C:\\Users\\AMANDODOSSANTOSNETO\\AppData\\Roaming\\npm\\node_modules\\#ionic\\cli', execPath: 'C:\\project_cren\\plugin\\ci-uix-mobile-master', version: '6.7.0' } +0ms
ionic:lib:integrations:cordova:config Loading Cordova Config (config.xml: 'C:\\project_cren\\plugin\\ci-uix-mobile-master\\config.xml', package.json: 'C:\\project_cren\\plugin\\ci-uix-mobile-master\\package.json') +0ms
ionic:commands:run Native platform devices: [] +0ms
ionic:lib:integrations:cordova:config Loading Cordova Config (config.xml: 'C:\\project_cren\\plugin\\ci-uix-mobile-master\\config.xml', package.json: 'C:\\project_cren\\plugin\\ci-uix-mobile-master\\package.json') +11s
ionic:lib:build build options: {
ionic:lib:build '--': [],
ionic:lib:build engine: 'cordova',
ionic:lib:build platform: 'android',
ionic:lib:build project: 'app',
ionic:lib:build verbose: false,
ionic:lib:build configuration: undefined,
ionic:lib:build sourcemaps: undefined,
ionic:lib:build cordovaAssets: true,
ionic:lib:build watch: undefined,
ionic:lib:build type: 'angular'
ionic:lib:build } +0ms
ionic:lib:hooks Looking for ionic:build:before npm script. +0ms
ionic:lib:build Looking for ionic:build npm script. +154ms
ng:analytics getGlobalAnalytics +0ms
ng:analytics Client Analytics config found: false +47ms
ng:analytics Analytics disabled. Ignoring all analytics. +1ms
ng:analytics getSharedAnalytics +0ms
WARNING in ./src/app/invoice-detail/invoice-detail.component.scss
Module Warning (from ./node_modules/postcss-loader/src/index.js):
Warning
(4:3) start value has mixed support, consider using flex-start instead
# ./src/app/invoice-detail/invoice-detail.component.ts 27:41-83
# ./src/app/app.module.ts
# ./src/main.ts
# multi ./src/main.ts
ionic:lib:hooks Looking for ionic:build:after npm script. +40s
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> java.lang.NullPointerException (no error message)
* Try:
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.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
C:\project_cren\plugin\ci-uix-mobile-master\platforms\android\gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> java.lang.NullPointerException (no error message)
* Try:
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.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --debug --verbose exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
ionic:utils-process onBeforeExit handler: running 2 functions +1ms
ionic:utils-process error while killing process tree for 17344: Error: Command failed: taskkill /pid 17344 /T /F
ionic:utils-process ERROR: The process "17344" not found.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (child_process.js:303:12)
ionic:utils-process at ChildProcess.emit (events.js:315:20)
ionic:utils-process at maybeClose (internal/child_process.js:1051:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 17344 /T /F'
ionic:utils-process } +472ms
ionic:utils-process onBeforeExit handler: error from function: Error: Command failed: taskkill /pid 17344 /T /F
ionic:utils-process ERROR: The process "17344" not found.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (child_process.js:303:12)
ionic:utils-process at ChildProcess.emit (events.js:315:20)
ionic:utils-process at maybeClose (internal/child_process.js:1051:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 17344 /T /F'
ionic:utils-process } +21ms
ionic:utils-process error while killing process tree for 2628: Error: Command failed: taskkill /pid 2628 /T /F
ionic:utils-process ERROR: The process "2628" not found.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (child_process.js:303:12)
ionic:utils-process at ChildProcess.emit (events.js:315:20)
ionic:utils-process at maybeClose (internal/child_process.js:1051:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 2628 /T /F'
ionic:utils-process } +40ms
ionic:utils-process onBeforeExit handler: error from function: Error: Command failed: taskkill /pid 2628 /T /F
ionic:utils-process ERROR: The process "2628" not found.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (child_process.js:303:12)
ionic:utils-process at ChildProcess.emit (events.js:315:20)
ionic:utils-process at maybeClose (internal/child_process.js:1051:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 2628 /T /F'
ionic:utils-process } +8ms
ionic:utils-process processExit: exiting (exit code: 1) +4ms
GRADLE FILE=====================================================================
android {
//compileSdkVersion 29
//buildToolsVersion "29.0.3"
defaultConfig {
manifestPlaceholders = ['appIdRedirectScheme': android.defaultConfig.applicationId]
}
}
dependencies {
implementation 'com.github.ibm-cloud-security:appid-clientsdk-android:6.+'
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
JAVA FILE ==============================================
package ibm.com.ibmappidcordovaplugin;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.ibm.cloud.appid.android.api.AppID;
import com.ibm.cloud.appid.android.api.AuthorizationException;
import com.ibm.cloud.appid.android.api.AuthorizationListener;
import com.ibm.cloud.appid.android.api.LoginWidget;
import com.ibm.cloud.appid.android.api.tokens.AccessToken;
import com.ibm.cloud.appid.android.api.tokens.IdentityToken;
import com.ibm.cloud.appid.android.api.tokens.RefreshToken;
/**
* This class echoes a string called from JavaScript.
*/
public class ibmappidcordovaplugin extends CordovaPlugin {
//PluginResult result = null;
private CallbackContext callbackContext = null;
private static final String SHOW_AUTH = "authentication";
LoginWidget loginWidget;
loginWidget = AppID.getInstance().getLoginWidget();
public ibmappidcordovaplugin(){
AppID.getInstance().initialize(getApplicationContext(), "cdb1c3ab-e8cf-49cf-9dff-9dfa4bf2a898", AppID.REGION_US_SOUTH);
}
#Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
this.callbackContext = callbackContext;
String msg = args.getJSONObject(0).getString("msg");
if (action.equals("authentication")) {
//String message = args.getString(0);
this.coolMethod(msg, callbackContext);
return true;
}
return false;
}
private void coolMethod(String message, CallbackContext callbackContext) {
if (message != null && message.length() > 0) {
auth();
callbackContext.success(create());
} else {
callbackContext.error("Expected one non-empty string argument.");
}
}
private void auth(){
loginWidget.launch(this, new AuthorizationListener() {
#Override
public void onAuthorizationSuccess(final AccessToken accessToken, final IdentityToken identityToken,
RefreshToken refreshToken) {
cordova.getActivity().runOnUiThread(new Runnable() {
#Override
public void run() {
console.log("Name: " + identityToken.getName());
console.log("user: " + accessToken.getScope());
console.log("getIdentities " + identityToken.getIdentities());
console.log("getRaw " + identityToken.getRaw());
for (String name : identityToken.getAudience() ) {
console.log("AUD: " +name);
}
for (String name : identityToken.getAuthenticationMethods() ) {
console.log("AUTH: " +name);
}
try {
JSONObject ob = identityToken.getPayload();
console.log("getPayload " + ob.getString("preferred_username"));
}
catch (Exception e){
console.log("Error: " + e.getMessage());
}
}
});
}
#Override
public void onAuthorizationCanceled() {
}
#Override
public void onAuthorizationFailure (AuthorizationException exception) {
}
});
}
private String create(/*IdentityToken identityToken*/){
String response = "";
try {
JSONObject token = new JSONObject();
String t = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImFwcElkLWNkYjFjM2FiLWU4Y2YtNDljZi05ZGZmLTlkZmE0YmYyYTg5OC0yMDIwLTA5LTI1VDE1OjE5OjI4LjIxNyIsInZlciI6NH0.eyJpc3MiOiJodHRwczovL3VzLXNvdXRoLmFwcGlkLmNsb3VkLmlibS5jb20vb2F1dGgvdjQvY2RiMWMzYWItZThjZi00OWNmLTlkZmYtOWRmYTRiZjJhODk4IiwiYXVkIjpbIjc5NWUzMmVlZWFjMzIzMTM5YmM5ZWU3YmQ2NWEyMTc5YjNhNzc3ZjgiXSwiZXhwIjoxNjAyOTc2ODg0LCJ0ZW5hbnQiOiJjZGIxYzNhYi1lOGNmLTQ5Y2YtOWRmZi05ZGZhNGJmMmE4OTgiLCJpYXQiOjE2MDI5NzMyODQsImVtYWlsIjoiYW1hbmRvc0Bici5pYm0uY29tIiwibmFtZSI6IlZvbHVudGFyaW8gRmVsaXogZGEgVmlkYSIsInN1YiI6ImMyMjQ3ZWU3LTc3ZDEtNDFhMy04NjQ3LWRmNTNhMWMyMWJiMiIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiIxMjM0NTY3OCIsImdpdmVuX25hbWUiOiJWb2x1bnRhcmlvIiwiZmFtaWx5X25hbWUiOiJGZWxpeiBkYSBWaWRhIiwiaWRlbnRpdGllcyI6W3sicHJvdmlkZXIiOiJjbG91ZF9kaXJlY3RvcnkiLCJpZCI6IjU0NmU5NTk5LWJjMGItNDIxNi04YzljLTQ2N2RjZWQ5NjQ4NCJ9XSwiYW1yIjpbImNsb3VkX2RpcmVjdG9yeSJdfQ.C4_2mj3fx3IwfqH4_O8CR4NtSNpgR7WTbjOz9j1XvrAZS9uiTswMyCn9q8N8pIh6BuP2RTmBhAtnkjAYt0rkHOtEHutf9J79GkpN33-H5P-5k9pqopUuawyFZlfEuH3m76PVnH2XkDUZ1EOTRKrtuHIyYS74tGOYgF8r3hBwjSbFZPTchkNAQmqn5FTgJ6LzUa3xBWt3C1nkvMw3nKrorAUtrsCZXD9PGJKlqJhpZXH9renSRa4KDDwswHzhLGiIghgAmvVoNwOsUWrWbQF88EGDKAkyQRCnTRo2lqdANtYlIwsVitGc9zkje6wDOhjjfZ6g24sj9Id-kK7Sw813aQ";
token.put("name", "Fulando da Silva"/*identityToken.getName()*/);
token.put("email", "fulano#test.com"/*identityToken.getEmail()*/);
token.put("token", t/*identityToken.getRaw()*/);
response = token.toString();
} catch (JSONException e) {
throw new RuntimeException(e);
}
return response;
}
}

WKWebView turns black when "Open Link" pressed after long press a link

I'm programming in swift and run into an error that my WKWebView turns black after "open link" or "add to photos" in safari.
So I got my WebView and everything works fine. But when I long press on (e.g. an image) the apple-dropdown-menu opens with "open link", "add to reading list", ..., "add to photos". Now when I just close the dropdown menu again and go to home screen and open the app again, the webview turns black. The console says it's loading and didFinish, but I can't see anything. Anyone knows possible issues?
When I pressed "open link" on the dropdown-menu safari opens with that link. But when I move back to my app, the screen turns black. Here is the code of the console after opening my app again.
--------------------- SCENEDELEGATE sceneWillEnterForeground ---------------------
2020-08-13 13:48:38.560642+0200 GMP[1817:418564] [ProcessSuspension] 0x282f2aa00 - WKProcessAssertionBackgroundTaskManager: Ignored request to start a new background task because the application is already in the background
2020-08-13 13:48:38.561286+0200 GMP[1817:418564] [ProcessSuspension] 0x282f2aa00 - WKProcessAssertionBackgroundTaskManager: Ignored request to start a new background task because the application is already in the background
--------------------- SCENEDELEGATE sceneDidBecomeActive ---------------------
currentUrl: https://myWebPage.com/
loadUrl(link: https://myWebPage.com/)
didStartProvisionalNavigation webView(_:didStartProvisionalNavigation:)
didCommit webView(_:didCommit:)
2020-08-13 13:48:39.341814+0200 GMP[1817:418614] [assertion] Error acquiring assertion: <NSError: 0x282ff4db0; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
userInfo = {
RBSAssertionAttribute = <RBSLegacyAttribute: 0x102c8f640; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
}
}
2020-08-13 13:48:39.341902+0200 GMP[1817:418614] [ProcessSuspension] 0x1094e0438 - ProcessAssertion() PID 1817 Unable to acquire assertion for process with PID 1819
2020-08-13 13:48:39.342137+0200 GMP[1817:418564] [ProcessSuspension] 0x1094e0438 - ProcessAssertion::processAssertionWasInvalidated()
2020-08-13 13:48:39.342917+0200 GMP[1817:418614] [assertion] Error acquiring assertion: <NSError: 0x282ff4de0; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
userInfo = {
RBSAssertionAttribute = <RBSLegacyAttribute: 0x1040ae040; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
}
}
2020-08-13 13:48:39.342998+0200 GMP[1817:418614] [ProcessSuspension] 0x1094e0460 - ProcessAssertion() PID 1817 Unable to acquire assertion for process with PID 1817
2020-08-13 13:48:39.343085+0200 GMP[1817:418564] [ProcessSuspension] 0x1094e0460 - ProcessAssertion::processAssertionWasInvalidated()
2020-08-13 13:48:39.343851+0200 GMP[1817:418614] [assertion] Error acquiring assertion: <NSError: 0x282ffcea0; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
userInfo = {
RBSAssertionAttribute = <RBSLegacyAttribute: 0x10415ddb0; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
}
}
2020-08-13 13:48:39.343954+0200 GMP[1817:418614] [ProcessSuspension] 0x1094e0488 - ProcessAssertion() PID 1817 Unable to acquire assertion for process with PID 1818
2020-08-13 13:48:39.344028+0200 GMP[1817:418564] [ProcessSuspension] 0x1094e0488 - ProcessAssertion::processAssertionWasInvalidated()
2020-08-13 13:48:39.905526+0200 GMP[1817:418815] [assertion] Error acquiring assertion: <NSError: 0x282f3b690; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
userInfo = {
RBSAssertionAttribute = <RBSLegacyAttribute: 0x10414ea00; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
}
}
2020-08-13 13:48:39.905574+0200 GMP[1817:418815] [ProcessSuspension] 0x1094e20a8 - ProcessAssertion() PID 1817 Unable to acquire assertion for process with PID 1819
2020-08-13 13:48:39.905602+0200 GMP[1817:418564] [ProcessSuspension] 0x1094e20a8 - ProcessAssertion::processAssertionWasInvalidated()
2020-08-13 13:48:39.906163+0200 GMP[1817:418815] [assertion] Error acquiring assertion: <NSError: 0x282f39590; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
userInfo = {
RBSAssertionAttribute = <RBSLegacyAttribute: 0x102d4d0c0; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
}
}
2020-08-13 13:48:39.906196+0200 GMP[1817:418815] [ProcessSuspension] 0x1094e20d0 - ProcessAssertion() PID 1817 Unable to acquire assertion for process with PID 1817
2020-08-13 13:48:39.906218+0200 GMP[1817:418564] [ProcessSuspension] 0x1094e20d0 - ProcessAssertion::processAssertionWasInvalidated()
2020-08-13 13:48:39.906769+0200 GMP[1817:418815] [assertion] Error acquiring assertion: <NSError: 0x282f391d0; domain: RBSAssertionErrorDomain; code: 2; reason: "Client is missing required entitlement"> {
userInfo = {
RBSAssertionAttribute = <RBSLegacyAttribute: 0x102c66420; requestedReason: FinishTaskUnbounded; reason: FinishTaskUnbounded; flags: PreventTaskSuspend>;
}
}
2020-08-13 13:48:39.906803+0200 GMP[1817:418815] [ProcessSuspension] 0x1094e20f8 - ProcessAssertion() PID 1817 Unable to acquire assertion for process with PID 1818
2020-08-13 13:48:39.906828+0200 GMP[1817:418564] [ProcessSuspension] 0x1094e20f8 - ProcessAssertion::processAssertionWasInvalidated()
didFinish webView(_:didFinish:)
didSet currentUrl = https://myWebPage.com/

Sending email with attachments via flutter_email_sender is not working on Android

I'm trying to send an email with a pdf attachment using flutter_email_sender, it works fine on iOS but throws Failed to find configured root error on Android. Below is the code.
Future<void> _downloadFile(String url, String filename) async {
var request = await httpClient.getUrl(Uri.parse(url));
var response = await request.close();
var bytes = await consolidateHttpClientResponseBytes(response);
String dir = (await getApplicationDocumentsDirectory()).path;
File file = new File('$dir/$filename');
await file.writeAsBytes(bytes);
setState(() {
_file = file;
});
}
final Email email = Email(
body: 'Email body',
subject: 'Email subject',
recipients: ['email#gmail.com'],
attachmentPath: _file.path,
);
await FlutterEmailSender.send(email);
and the stack trace:
E/MethodChannel#flutter_email_sender: Failed to handle method call
java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.xxx.xx/app_flutter/account_opening.pdf at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:739)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:418)
at com.sidlatau.flutteremailsender.FlutterEmailSenderPlugin.sendEmail(FlutterEmailSenderPlugin.kt:95)
at com.sidlatau.flutteremailsender.FlutterEmailSenderPlugin.onMethodCall(FlutterEmailSenderPlugin.kt:38)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:643)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:326)
at android.os.Looper.loop(Looper.java:160)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2019-09-11 13:44:42.484 26003-26003/com.xxx.xx W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy#98fb11f
2019-09-11 13:44:42.505 26003-26003/com.xxx.xx D/AndroidRuntime: Shutting down VM
2019-09-11 13:44:42.512 26003-26003/com.xxx.xx E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxx.xx, PID: 26003
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.xx/com.kiwi.fluttercrashlytics.CrashActivity}: com.kiwi.fluttercrashlytics.FlutterException: PlatformException(error, Failed to find configured root that contains /data/data/com.xxx.xx/app_flutter/account_opening.pdf, null)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: com.kiwi.fluttercrashlytics.FlutterException: PlatformException(error, Failed to find configured root that contains /data/data/com.xxx.xx/app_flutter/account_opening.pdf, null)
at StandardMethodCodec.decodeEnvelope(package:flutter/src/services/message_codecs.dart:564)
at MethodChannel.invokeMethod(package:flutter/src/services/platform_channel.dart:316)
at FlutterEmailSender.send(package:flutter_email_sender/flutter_email_sender.dart:10)
at _EmailWidgetState.build.<fn>(package:gsec/shared/widgets/manualPDFWidget/email_widget.dart:136)
at OnboardingNextButtonWidget.build.<fn>(package:gsec/onboardingScreen/onboard_next_button_widget.dart:84)
at GestureRecognizer.invokeCallback(package:flutter/src/gestures/recognizer.dart:182)
at TapGestureRecognizer._checkUp(package:flutter/src/gestures/tap.dart:365)
at TapGestureRecognizer.acceptGesture(package:flutter/src/gestures/tap.dart:312)
at GestureArenaManager.sweep(package:flutter/src/gestures/arena.dart:156)
at _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent(package:flutter/src/gestures/binding.dart:222)
at _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent(package:flutter/src/gestures/binding.dart:198)
at _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent(package:flutter/src/gestures/binding.dart:156)
at _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue(package:flutter/src/gestures/binding.dart:102)
at _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket(package:flutter/src/gestures/binding.dart:86)
at ._rootRunUnary(dart:async/zone.dart:1136)
at _CustomZone.runUnary(dart:async/zone.dart:1029)
at _CustomZone.runUnaryGuarded(dart:async/zone.dart:931)
at ._invoke1(dart:ui/hooks.dart:250)
at ._dispatchPointerDataPacket(dart:ui/hooks.dart:159)
It is not possible to attach files from ApplicationDocumentsDirectory since this directory is only accessible from your app. You have to use a directory like ExternalStorageDirectory to be able to send from it. If you do so don't forget to add WRITE_EXTERNAL_STORAGE permission to your app before release.
Cheers.