Unable to resolve host "mydomain.com": No address associated with hostname - android

Error
UPDATE: Solved, it was a configuration error in Samsung Knox.
Here is another question about
SocketException: Failed host lookup: 'mydomain.com'
(OS Error: Unable to resolve host "mydomain.com": No address associated with hostname, errno = 7)
Background
My app calls my API:s, plain and simple. It used to work the other day, but after an update it stopped working and I got the error above. (The update had minor changes, should not affect this)
Flutter app.
Android device, Samsung Tab A (SM-515).
The device has internet connection.
The app has all the permissions needed to access internet.
I am able to visit a site on the same domain using the browser.
Restarting Wi-Fi does not help.
Disabling Wi-Fi and using mobile network does not help.
Restarting device does not help.
Uninstalling the app and reinstalling it does not help.
Uninstalling the app and installing the debug version helps, it can now access the API.
Uninstalling the debug version and reinstalling the release version does not help, same error again.
The exact same release version work on a different, but identical device.
Requests are sent with package:http/http.dart, get method.
The API does not have any authentication, anonymous access allowed.
I replaced http.dart with package:dio/dio.dart, same result.
I've updated flutter and all packages and done a complete rebuild, same result.
I've seen this error before, but only temporarily. The errors are logged to Sentry, but no errors from this device are logged, implicating that the app does not have internet access at all.
It is extremely frustrating. I've spent two days on this, my last option is to factory reset the device. I don't want to do that because I want to know what the cause is and how I can prevent it from happening again.
I need help on how to debug. What can I look for in adb logcat?
Edit:
Here are the permissions set in android/app/src/main/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_WIFI_STATE" />
Edit 2: More info in list.
Edit 3:
So I was going to try to get DNS info in the app using package:dns_client/dns_client.dart, but as I suspected the app does not access internet at all. I got the same error for the domains cloudflare-dns.com and dns.google.com.
Using InternetAddress.lookup("google.com") I got the error SocketException: Failed host lookup: 'google.com' (OS Error: No address associated with hostname, errno = 7).
Edit 4:
I created a new Flutter app from scratch. And it works when adding the permissions. The error is most likely related to the permissions, but somehow the app don't get it on one specific device. Is there a permission cache on Android that persists through uninstalls and restarts?
The info about the app says it has all the permissions needed. Is it a bug in Android?
Edit 5:
Running the command adb shell dumpsys package package.name to list permissions and got this result, which shows that network access is granted.
install permissions:
android.permission.INTERNET: granted=true
android.permission.ACCESS_NETWORK_STATE: granted=true
android.permission.ACCESS_WIFI_STATE: granted=true

Related

How to fix App not installed error on android 10?

I created my app, generated a signed apk and tried to install it. I got an error App not installed. I rebooted the device, resigned apk, tried again. But nothing worked. On the emulator everything is ok. How can I fix the problem? I try to install apk to android 10. The minimum SDK is 21. Permissions:
<uses-permission android:name="android.permission.INTERNET" />
I don't know what else may influence and cause this error. Please, help me
Scenario one
The application where you want to install your app from whether it was Google Drive or File Manager doesn't have the permission to Install apps from unknown sources
So go to the >> App info and set this permission enabled.
Scenario Two
Installing an app from Google Drive issue happened with a client of mine, and we were uploading the app to MediaFire instead.
I think in that case the application would be downloaded and installed from the browser Chrome and by turn it should have the same permission Install apps from unknow sources enabled.
Don't forget If an old version of the app was installed on your device make sure to un-install it manually

addAccountExplicitly throws SecurityException because com.google.android.gm is not allowed to perform GET_ACCOUNTS

My app uses SyncAdapters to sync data in the background. On a device running OS 8.0 and setup for Android for Work managed profile, calling addAccountExplicitly throws a SecurityException and fails to add the account properly.
Here is the callstack:
11-28 17:28:00.182 7291-7291/com.example.android.basicsyncadapter E/CreateSyncAccount: Failed
java.lang.SecurityException: com.google.android.gm from uid 10074 not allowed to perform GET_ACCOUNTS
at android.os.Parcel.readException(Parcel.java:1942)
at android.os.Parcel.readException(Parcel.java:1888)
at android.accounts.IAccountManager$Stub$Proxy.addAccountExplicitly(IAccountManager.java:1205)
at android.accounts.AccountManager.addAccountExplicitly(AccountManager.java:875)
at com.example.android.basicsyncadapter.SyncUtils.CreateSyncAccount(SyncUtils.java:58)
at com.example.android.basicsyncadapter.EntryListFragment.onAttach(EntryListFragment.java:148)
I have reproduced the failure using two GitHub projects running 8.0 on a Pixel:
fingerprint=google/marlin/marlin:8.0.0/OPR3.170623.013/4397526:user/release-keys
GitHub apps:
https://github.com/googlesamples/android-testdpc
https://github.com/googlesamples/android-BasicSyncAdapter
Here are the steps to reproduce throwing the above exception:
Factory reset the device and wait for the out-of-box screen to appear.
Install the application android-testdpc. Complete setting up the device for Android for Work managed profile.
Do not change any policies and do not restart the device.
Install the application android-BasicSyncAdapter and launch it.
Logcat will capture
I am_crash: [7489,0,com.example.android.basicsyncadapter,950582854,java.lang.SecurityException,com.google.android.gm from uid 10075 not allowed to perform GET_ACCOUNTS,Parcel.java,1942]
Additional Notes:
I am seeing the SecurityException being thrown on devices with Android 8.0 only.
Restarting the device before launching android-BasicSyncAdapter does not cause the SecurityException to be thrown. Currently proposed work around for users.
I am trying to figure out how to successfully call addAccountExplicitly without having to first restart the device.
My Google Pixel device received a 8.1 update which I installed. Retesting with the two applications:
https://github.com/googlesamples/android-testdpc
https://github.com/googlesamples/android-BasicSyncAdapter
Then following the steps to reproduce, the SecurityException is no longer being thrown.
To verify that it is not the test apps that have changed to fix the problem, I flashed my Pixel device with the specified 8.0 ROM image. Retested and the SecurityException is thrown in the same manner.
The problem appears to be fixed after OS version 8.0.

IONIC Application showing no internet connection

I have successfully installed cordova network plugin and no errors so far from the code side.
When I use ionic serve to get the app to run on my browser, it detects my wifi and the plugin recognizes a connection, and if i disable wifi on my computer, it again recognizes that there is no internet connection.
The problem now comes when I install the app onto an android phone after building. I even have Bluestacks on my computer but the app does not get the network from there too. Has anyone run into this problem? How did you go through it?
I do not think it is an issue with my code, so I am not posting code, unless someone will need it for clarification.
I hope someone is able to help.
Permission in androidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
config.xml do include:
<access origin="*" />
Problem Solved : As Permission Issue Held Due to Permission Was Listed in Dangerous Permission.
I Lowered my TargetSDKVersion

error code during application install -24 on Rooted device from Google Play Store

I am trying to install the App from Google Play Store. Gets downloaded and fails during installation with:
unknown error code during application install -24
The Same Application got installed with different certificate during debug runs from Android Studio. Now it is not getting deleted or over written. How can i clear the cache completely?
Connected the Mobile using USB and tried to run debug from Android Studio. I get following error on debug run APK transfer.
Failure [INSTALL_FAILED_UID_CHANGED]
Deleting the app through Terminal using adb shell command helped in one of the mobile.
In other mobile, even adb shell command did not work out.
Resetting mobile to Factory setting as final solution helped.
PS: Please voteup if you find this helpful.Thanks
Check manifest file and compare with previous one.
If your manifest file contain android:sharedUserId in previous version and it is absent in current version then this error will occured.
Solution is uninstall it and install fresh copy.
The main cause of Google Play Store Error Unknown Error Code During Application Install: 24 is cache problem. However, it can arise at different aspects as listed below:
It can be due to Google Play Store Cache and Data problem.
It can arise due to unwanted junk and residue files.
This error can also appear if you are trying to install an app which was earlier installed in your phone and was uninstalled but all the files of the app was not deleted from your phone.
It can also be caused if your internal storage is full.
Depending on the causes, there are 5 Solutions to Fix Google Play Store Error Unknown Error Code During Application Install: 24. They are listed below:
Solution 1 – Restart your Android Phone.
Solution 2 – Clear Cache and Data of Google Play Store, Google Service Framework and Download Manager.
Solution 3 – Remove Junk files from your internal storage.
Solution 4 – Check if you have sufficient memory in your internal storage.
Solution 5 – Factory Reset your Android Phone.

Unknown error code during application install "-505"

I have checked this android 5.0 lollipop app install shows Unknown error code during application install: "-505". But it doesn't seem to address my case as I dont use multiuser env.
I have an app in the playstore which worked fine on my nexus 4(4.4.x) till i upgraded to lollipop and it showed this error every time i tried to install it from playstore(It installs fine if I run it via adb).
Can't understand why I might be facing this issue, neither is there any other reference to this error code.
Any help is appreciated.
This seems stupid on my part, yet finally found the answer which seems to be the fact that I had another dev app(diff package name) which had a common signed permission with the playstore app.
Buried deep in my logcat was this.
11-21 16:20:02.855: E/Finsky(8986): [1] PackageInstallerImpl.handleCommitCallback: Error -505
while installing <package>: INSTALL_FAILED_DUPLICATE_PERMISSION: Package <package> attempting to
redeclare permission <package>.permission.MAPS_RECEIVE already owned by
beginning with lollipop it seems this isn't permitted.
Thanks to everyone.
EDIT
The solution if not apparent yet is to change the permission from
<permission android:name="<old package>.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
to
<permission android:name="<new package>.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
or whichever signed permission that is causing the same.
With an official Lollipop version
and for mac users (i'm sure it's analogue to windows users):
Go to the terminal,
cd into: ADT/sdk/platform-tools
type ./adb uninstall the.app.package
and thats it!
you just uninstalled the app
don't add the -k flag - ('-k' means keep the data and cache
directories)
good luck!
This is caused by a bug with app certificate parsing in Lollipop:
https://code.google.com/p/android/issues/detail?id=79089
If the app you are trying to install has the same certificate as a similar app or related app with the SAME certificate, then Android 5.0 won't allow the installation, believing you are installing a duplicate of the already installed (but different) app. Only solution that worked for me? Uninstall the app with the same certificate, which would be an app made by same developer that made the app you are trying to install. Once you've uninstalled that app, install the problematic app, then go back and reinstall the other app which was already installed. This problem happened to me only once, when trying to install the FB Messenger app. I finally was able to install it after I uninstalled the Facebook app. Then I reinstalled Facebook after Messenger was installed. OK, good luck to all and hope this helps some of you.
Multiple users installing same app on same device may cause this error. Please remove other app from the device and that should work.
I faced similar issue, however in my case it was an old development build sitting on my device and when I was trying to install from play store this error was coming.
I have got similar problem and solved with this solution.
Solution: After you update your Android device to Android 5.0 Lollipop from an older version using Over-the-air update or sideloading factory image, do a factory reset. It has been found out that if you do a factory reset immediately after updating your Android version, the error does not occur, but if you don’t the error persists. Don’t forget to clear the cache too, going to Menu > Settings > Apps > Google Play Store > Clear Cache. Clear the data too, from the very same option.
Source: http://appslova.com/android-fix-unknown-error-code-application-install-505-error-505/
Hope this help!!
Try resetting the play store app. You won't lose your apps following these steps. Nothing important will be lost.
Steps to follow on a motorola xoom
Go to the app drawer (menu)
Tap settings
Tap applications
Tap the "All" tab
Scroll through and look for play store
Tap Play Store (not play store services!)
Tap "clear data"
You will then get a warning, click "ok"
That's it, go through your problem again and see if it fixed. Bear in mind you will have to re-accept the terms and conditions for the play store app, when this comes up, simply click "accept"
try adding applicationId to the defaultConfig section of gradle file like
defaultConfig {
applicationId "com.example.www"
}

Categories

Resources