Ionic 4 Android 9.0 Login failed - ionic-framework

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

Related

Flutter : google map dont show

I have flutter app using google map, I created project and api key in google cloud,and enabled for both Andriod and iOS.
I add these permisions to AndroidManifest.xml :
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
also ad Api Key to AndroidManifest.xml:
<application
android:label="xxxx"
android:icon="#mipmap/launcher_icon">
<activity
.............
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
then I used getlocator package to get location in provider for showing the map :
GoogleMap(
mapType: MapType.normal,
initialCameraPosition: CameraPosition(
target: LatLng(authProvider.latitudePosition,
authProvider.longitudePosition),
zoom: 14))
nothing to show on emulator (the emulator using google play) also I get this :
updateAcquireFence: Did not find frame.

google_maps_flutter only works on IOS. I'm having a problem when it comes to Android

Edit :
We decided to use OpenStreetMap instead of Google Maps. Actually, we were thinking of returning to OpenStreetMap in the future, but we did not want to spoil what was written. We made this decision because the fix would be too costly. Thanks for yours helps.
The project in use will be added to the project to add extra features. After adding maps that work smoothly on IOS, when it comes to Android, I get the error "Unexpected response code 503 for https://clients4.google.com/glm/mmap/api" in the Debug Console section. The full error is below...
what did i check
api key connection
Android Emulator (Creating a different project containing Google Maps. It worked with the android emulator without any problem, but the screen does not appear in the project where I got the error.)
dependencies update
Emulator has google play services
Full Error Code
Unexpected response code 503 for https://clients4.google.com/glm/mmap/api
W/MobStoreFlagStore(26335): java.util.concurrent.ExecutionException: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.dotdotdot.dotdot_dotdot, sha256=[de6158b2bcbe47a9e13cccf90dc960571efc28ca09f89e29840e87729f126466], atk=false, ver=221514037.true (go/gsrlt)
W/MobStoreFlagStore(26335): at agw.s(:com.google.android.gms.dynamite_mapsdynamite#221514081#22.15.14 (150400-0):3)
W/MobStoreFlagStore(26335): at agw.get(:com.google.android.gms.dynamite_mapsdynamite#221514081#22.15.14 (150400-0):2)
W/MobStoreFlagStore(26335): at aig.g(:com.google.android.gms.dynamite_mapsdynamite#221514081#22.15.14 (150400-0):2)
W/MobStoreFlagStore(26335): at wy.c(:com.google.android.gms.dynamite_mapsdynamite#221514081#22.15.14 (150400-0):1)
W/MobStoreFlagStore(26335): at xa.run(:com.google.android.gms.dynamite_mapsdynamite#221514081#22.15.14 (150400-0):0)
W/MobStoreFlagStore(26335): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
W/MobStoreFlagStore(26335): at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/MobStoreFlagStore(26335): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
W/MobStoreFlagStore(26335): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/MobStoreFlagStore(26335): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/MobStoreFlagStore(26335): at java.lang.Thread.run(Thread.java:923)
W/MobStoreFlagStore(26335): Caused by: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.bilicisoft.visit_ankara, sha256=[de6158b2bcbe47a9e13cccf90dc960571efc28ca09f89e29840e87729f126466], atk=false, ver=221514037.true (go/gsrlt)
W/MobStoreFlagStore(26335): at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
W/MobStoreFlagStore(26335): at android.os.Parcel.createException(Parcel.java:2357)
W/MobStoreFlagStore(26335): at android.os.Parcel.readException(Parcel.java:2340)
W/MobStoreFlagStore(26335): at android.os.Parcel.readException(Parcel.java:2282)
Error Code ScreenShots
Dependencies
environment:
sdk: ">=2.16.2 <3.0.0"
dependencies:
mobx: ^2.0.1
flutter_mobx: ^2.0.0
mobx_codegen: ^2.0.1+3
build_runner: ^2.0.6
easy_localization: ^3.0.0
shared_preferences: ^2.0.0
dio: ^4.0.0
google_maps_flutter: 2.1.5
Google Maps Code
(I remind you again. This code doesn't work for me on Android, but it does on iOS. I don't think there is a problem with the code.)
Container(
height: 300,
child: googleMap.GoogleMap(
mapType: googleMap.MapType.normal,
initialCameraPosition: googleMap.CameraPosition(
target: googleMap.LatLng(_place?.lat ?? 0, _place?.lng ?? 0),
zoom: 15,
),
onMapCreated: (googleMap.GoogleMapController controller) {
_controller.complete(controller);
},
markers: Set<googleMap.Marker>.of([
googleMap.Marker(
markerId: googleMap.MarkerId(_place?.title ?? ""),
position: googleMap.LatLng(_place?.lat ?? 0, _place?.lng ?? 0))
]),
),
),
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dotdot.dot_dot>
<queries>
<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.SENDTO" />
<data android:scheme="smsto" />
</intent>
</queries>
<application
android:label="APP Name"
android:icon="#mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyC_K9N2..........ASD_s4"/>
</application>
</manifest>
trying out all the above in Summary:
Enabled Android and iOs SDK on Cloud Console
Added Secret Key to Android Manifest
Adding Map on my App
Running the command Flutter clean
check all config google map for android
Uninstall the app from your device (Phone or Emulator) then compile afresh.
Below permissions missing in your androidfestml file check out,
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dotdot.dot_dot>
//add this one
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:label="APP Name"
android:icon="#mipmap/ic_launcher"
android:usesCleartextTraffic="true">
//add this too
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />

Image is not loading in Ionic 3

I am working on ionic 3. I updated ionic-cli, nodejs and cordova versions in the project. After updating the version, the images are not loading in android. But It's working fine in the browser. I applied all the suggestions but it's not fixed yet.
The error which I am getting.
Appi_demo_a.png:1 GET http://localhost/assets/icon/Appi_demo_a.png net::ERR_CONNECTION_REFUSED
I am doing to fix it.
add this in confix.xml
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:usesCleartextTraffic="true" />
<application android:networkSecurityConfig="#xml/network_security_config" />
</edit-config>
network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system"/>
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">localhost</domain>
<domain includeSubdomains="true">spiapi.demo.com</domain>
</domain-config>
</network-security-config>
version details
Ionic:
Ionic CLI : 6.12.1
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.2.4
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : 5.0.4, android 9.0.0, browser
Cordova Plugins : cordova-plugin-ionic-webview 5.0.0, cordova-plugin-ionic 5.4.7, (and 17 other plugins)
NodeJS : v14.15.0
npm : 6.14.8

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.

unable to deploy Android APK on a blackberry device

I have been trying to figure this out for a couple of days now,
I created some apps, I followed the steps to get a signed APK (https://www.udacity.com/wiki/ud853/course_resources/creating-a-signed-apk) .
The APK installs fine on android devices, but when I try to deploy on BB device, I get a "unable to install" message. An APK (downloaded from google play to my PC, then saved to the BB device) installs fine on the BB device, but non of my apps can be installed.
I think I am missing something I should do before or after creating the signed APK. Is there a way to diagnose or find the reason the installation is failing??
Here is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.asamater.myapplication" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Solved:
minimum supported API must be 18 or under.