Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Play Store Error -505

When uploading an APK to the Android Developer Console, everything goes normal, but there are a certain subset of users on android 5.0 and up that are unable to install or upgrade the APK. These users see a Google Play Store error 505.

like image 615
Nic Capdevila Avatar asked Jan 05 '16 17:01

Nic Capdevila


People also ask

Why does My Play Store keep saying try again?

You are either signed in with multiple accounts, and one of those is causing the error. Or, you recently changed the password to your Google account and need to relogin with the new credentials. The Play Store error is also caused due to data storage and cache issues on your Android device.

Why Play Store is not working now?

To resolve Play Store Not Working try restarting your router and in case of mobile data, try restarting your device or enabling AIrplane mode for a couple of minutes and then enabling it. This can help re-establish a strong internet connection.

Why is my Play Store saying error no connection?

One of the reasons for this error could be the cache of the Play store. So the easiest solution is to clear the cache. For this go to Settings > Apps and scroll to All apps section and find the “Google Play Store” app listed there. Open the app and hit clear cache button and also force stop this app.


2 Answers

There are several different resources that tell you that the 505 error is a conflict of permission. Starting in Android Lollipop, you are no longer able to have duplicate custom permissions with the same name https://developer.android.com/about/versions/android-5.0-changes.html#custom_permissions. If you check stackoverflow for this error you'll find multiple reports of people offering this as a solution. While this can sometimes be the cause of this error there are several other reasons that this, and other conflicts can happen.

1. More than one app defines the same permission

If two completely different apps define the same permission e.g if you have a user and a manager app, and both of them have something along the lines of:

<permission
        android:name="same.package.name.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

2. Same app signed by different keys

You have the same app, but signed by different keys. For example if you had a release version and a debug version, you'll hit a conflict because the system sees this as two different apps requesting the same permission.

3. Conflicting authorities

But there is an entirely different situation that can occur, which is less obvious. The 505 error can also occur with conflicting authorities. If two different apps declare the same provider, such as

<provider
    android:name=".provider.YourProvider"
    android:authorities="com.roqbot.client.YourProvider"
    android:exported="false" />

This can also provide a conflict.

The last, and hardest conflict to spot, is one that can happen with Google Play Services 8.1 and up. If you do not define an application id in your build.gradle file like this:

defaultConfig {
    applicationId "com.example.my.app"
}

it is possible that it will auto-generate a provider that can conflict with other apps. To check this, go into your your build>intermediates>manifests>full>release>AndroidManifest.xml and look for

<provider
    android:name="com.google.android.gms.measurement.AppMeasurementContentProvider"
    android:authorities="com.google.android.gms.google_measurement_service"
    android:exported="false" />

Here the authority name will conflict with other apps. If you add the applicationId to the default config, it will change this authority to

<provider
    android:name="com.google.android.gms.measurement.AppMeasurementContentProvider"
    android:authorities="com.example.my.app.google_measurement_service"
    android:exported="false" />

This is very subtle and appears to be a bug starting in google play services 8.1. The issue can be seen discussed here. https://code.google.com/p/android/issues/detail?id=189079&can=1&q=error%20505&sort=-opened&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened

The point to remember is that it may be several things, and the only thing you can verify for sure with a 505 error is that there is a conflict of some sort, and that it may or may not necessarily be a custom permission conflict.

like image 130
Nic Capdevila Avatar answered Oct 18 '22 05:10

Nic Capdevila


If you are using the Facebook SDK and following the official sample code, you might also encounter the issue. In my case, I was using a same content provider name on 2 different app's manifest.

 <provider
            android:authorities="com.facebook.app.FacebookContentProvider123"
            android:name="com.facebook.FacebookContentProvider"
            android:exported="true" />

I forgot to change the default name com.facebook.app.FacebookContentProvider123. Finally fixed it by adding a dynamic applicationId as provider name.

<provider
            android:authorities="com.facebook.app.FacebookContentProvider.${applicationId}"
            android:name="com.facebook.FacebookContentProvider"
            android:exported="true" />
like image 3
Prokash Sarkar Avatar answered Oct 18 '22 03:10

Prokash Sarkar