ionic splashscreen gives ERR_CONNECTION_REFUSED on older android - ionic-framework

After I package build my release using the Ionic Pro service, download it, and install it on a Android 4.4.2 device, I get an alert right over the splashscreen titled: "Application Error", with the following error:
net::ERR_CONNECTION_REFUSED (http://localhjost:8080/)
After a while the splashscreen dissapears and a white page says: "Webpage not available:"
Screenshot
It runs fine on another device, running Android 8.0.0.
What could cause this error and how do I fix it?

Downgrade your cordova-plugin-webview to 1.2.1, because version 2.x.x using http:// protocol instead of file://
https://ionic.zone/debug/ionic-and-android-4

Most of the people will suggest you to add to your config.xml the following line
<allow-intent href="http://localhost:<YOUR_PORT_HERE>/*" />
You already have this , so the above line is useless
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
Some users will suggest you to downgrade the cordova-plugin-ionic-webview plugin to to 2.1.2 version, for some users work for others not.
What i suggest you to do in your package.json file, add this to your
cordova-plugin-ionic-webview
from:
"cordova": {
"plugins": {
"cordova-plugin-ionic-webview": {}
},
to:
"cordova": {
"plugins": {
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
}
},

Related

Flutter url launcher not working on release build

I try to open dialer and sms app but its only working on debug mode when i make release build on run it on release its not working. I try everything
I already add this
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.DIAL" />
<data android:scheme="tel" />
</intent>
<intent>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
</intent>
Also flutter clean, upgrade not working
I also try to downgrade the plugin but stuck on this situation nothing is working for me
I try to run like this flutter run --release and its showing error that
Unhandled Exception: MissingPluginException(No implementation found for method launch on channel plugins.flutter.io/url_
launcher)
This error mostly solve by close app and run but in release mode nothing is working for me.
Dont know why its working on debug then.

Ionic 4 Android 9.0 Login failed

Android 9.0 not login but below 9.0 works fine
generally my code works fine on marshmallow
when I build my app android pie it is not working.
My code here below I can not understand this problem.
AndroidManifest.xml code
**<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="#mipmap/ic_launcher" android:label="#string/app_name" android:networkSecurityConfig="#xml/network_security_config" android:supportsRtl="true" android:usesCleartextTraffic="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="#string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="#android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="org.apache.cordova.camera.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/camera_provider_paths" />
</provider>
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>**
**Ionic Info : Ionic:**
Ionic CLI : 5.2.8 (C:\Users\Dev\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : #ionic/angular 4.11.1
#angular-devkit/build-angular : 0.801.3
#angular-devkit/schematics : 8.1.3
#angular/cli : 8.1.3
#ionic/angular-toolkit : 2.0.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.2, (and 12 other plugins)
Utility:
cordova-res : 0.6.0
native-run : 0.2.8
System:
Android SDK Tools : 26.1.1 (C:\Users\Dev\AppData\Local\Android\Sdk)
NodeJS : v10.13.0 (C:\Program Files\nodejs\node.exe)
npm : 6.11.3
OS : Windows 10
when login Android 9 show this problem only
HttpErrorResponse {headers: HttpHeaders, status: 0, statusText:
"Unknown Error", url: "http://example.com//access-token", ok: false, …}
error: ProgressEvent {isTrusted: true, lengthComputable: false, loaded: 0, total: 0, type: "error", …}
headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, headers: Map(0)}
message: "Http failure response for http://example.com//access-token: 0 Unknown Error"
name: "HttpErrorResponse"
ok: false
status: 0
statusText: "Unknown Error"
url: "http://example.com//access-token"
Since you didn't post your code part, here are some possible solution.
In most of the cases in ionic, Status code 0 usually indicates a CORS failure. Please check if CORS is enabled or not.
Second most possible cause is SSL certification.
Android platform level 28 disables cleartext network communications by default.
https://developer.android.com/training/articles/security-config.html#CleartextTrafficPermitted
https://stackoverflow.com/a/56178196/7803492
Step 1.
Open AndroidManifest.xml from [yourProject]/platform/android/app/src/main/AndroidManifest.xml
Setp 2.
Add this line to that file
android:usesCleartextTraffic="true"
step3. Save the file and rebuild the apk again

Android Build Error when using the barcodescanner and qrscanner at the same time

When I use the phonegap-plugin-barcodescanner plugin and the cordova-plugin-qrscanner plugin at the same time in a project, it won't compile for the android plattform. The error it outputs is duplicate permission element in the manifest. Upon checking I saw that this is indeed the case. However manual correction doesn't work as it will be regenerated automatically.
I documented the reproduction scenario further down. It is very simple. Maybe someone has an idea how to solve this issue? Or do you think this is a bug? But where should I open the issue in such a case?
Used version:
Ionic: 3.20.0
cordova: 8.0.0
Steps to reproduce:
Start a new project ionic start permissionissue blank (when it asks if it should integrate with the iOS and Android platform say yes, when it asks to install the ProSDK say no
Change into the project folder: cd permissionissue
Build it: ionic cordova build --release android -> Still everything is fine
Install the first plugin: ionic cordova plugin add phonegap-plugin-barcodescanner
Build it: ionic cordova build --release android -> Still everything is fine
Install the second plugin: ionic cordova plugin add cordova-plugin-qrscanner
Try to build it: ionic cordova build --release android -> Now it breaks
It will show the following error:
> Manifest merger failed with multiple errors, see logs
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or
--debug
option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
23 actionable tasks: 3 executed, 20 up-to-date
(node:12659) UnhandledPromiseRejectionWarning: Error: .../permissionissue/platforms/android/gradlew: Command failed with exit code 1 Error output:
.../permissionissue/platforms/android/app/src/main/AndroidManifest.xml:19:5-90 Error:
Element uses-permission#android.permission.CAMERA at AndroidManifest.xml:19:5-90 duplicated with element declared at AndroidManifest.xml:16:5-65
.../permissionissue/platforms/android/app/src/main/AndroidManifest.xml:20:5-85 Error:
Element uses-feature#android.hardware.camera at AndroidManifest.xml:20:5-85 duplicated with element declared at AndroidManifest.xml:18:5-84
.../permissionissue/platforms/android/app/src/main/AndroidManifest.xml Error:
Validation failed, exiting
FAILURE: Build failed with an exception.
The generated Manifest looks like this:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-permission android:name="android.permission.CAMERA" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
As you can see the CAMERA is once requested by itself and once with required false.
I had similar issue using cordova-plugin-camera-preview & cordova-plugin-qrscanner
What helped me was:
1. Go to plugins/cordova-plugin-qrscanner/plugin.xml
remove entries within
<config-file target="AndroidManifest.xml" parent="/*">
...
</config-file>
run
ionic cordova platform remove android
run
ionic cordova platform add android
This is how my <platform> section look like, from plugin.xml of cordova-plugin-qrscanner
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="QRScanner">
<param name="android-package" value="com.bitpay.cordova.qrscanner.QRScanner"/>
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/*">
<!-- <uses-permission android:name="android.permission.CAMERA" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" /> -->
</config-file>
<source-file src="src/android/QRScanner.java" target-dir="src/com/bitpay/cordova/qrscanner"/>
<framework src="src/android/qrscanner.gradle" custom="true" type="gradleReference"/>
</platform>
Worked for me, hope it help you as well.

phonegap facebook connect fail on iphone 4 and iphone 5

I'm developing an ios app with PhoneGap 3.4 which connects to facebook
I used this plugin to connect to facebook: https://github.com/phonegap/phonegap-facebook-plugin
everything works in emulators provided by xcode 5.1.
I tested the app on iphone 3gs and the connection to Facebook still works.
tested also with iphone 4s and facebook connection does not work: FB.login is not called.
the same happens on the iphone 5s.
no error in the xcode console and even in the safari console under developer mode.
the plugin is out of date
Make sure set your config.xml correctly
<access origin="https://m.facebook.com" />
<access origin="https://graph.facebook.com" />
<access origin="https://api.facebook.com" />
<access origin="https://*.fbcdn.net" />
<access origin="https://*.akamaihd.net" />
<feature name="org.apache.cordova.facebook.Connect">
<param name="ios-package" value="FacebookConnectPlugin" />
</feature>
OR
Use this command to install your facebook phonegap plugin
cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID="XXXXXXXXXXXXXX" --variable APP_NAME=“YOUR_APP_NAME
Don't ever use plugman to install cordova plugin.

Notification plugin not working phonegap 3.0 for iphone

I am developing an app with phonegap 3.0.0. I need to show the confirm dialog so I added the Notification plugin from phonegap CLI with the following command (as described in CLI Documentation):
$ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
But now I can't build the project. When I try to build it fails with following error:
** BUILD FAILED **
The following build commands failed:
CompileC build/CamTest.build/Debug-iphonesimulator/CamTest.build/Objects-normal/i386/CDVNotification.o CamTest/Plugins/org.apache.cordova.dialogs/CDVNotification.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
When I remove the Notification plugin everything works fine. I've also tried to add the following in my config.xml (CamTest/www/config.xml) to no effect:
<feature name="Notification">
<param name="ios-package" value="CDVNotification" />
</feature>
Please someone tell me how to work with plugins in Phonegap 3.0.0. I am trying it on iphone simulator. Thanks.
We were facing the same problem, but before we added the required lines in config.xml. So, the following two step process also mentioned in this and this link solved the problem.
On the command line
$ cordova plugin add
https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
In project's config.xml
<feature name="Notification">
<param name="ios-package" value="CDVNotification" />
</feature>