No internet access in signed APK

杀马特。学长 韩版系。学妹 提交于 2019-12-25 04:45:42

问题


I was working on an app that was working fine in the Debug build version and then I created a signed APK using keystore , and then with Android Studio --> Generate SIgned APK.

When I install the signed APK manually by downloading on to my phone, it asks for all permissions including internet access. However post installation, app starts but none of the server calls / API calls are working. The phone has internet connection though (webpages open up in browser)

My android manifest is :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.gmspartners.earthmiles" >


    <!-- To access Google+ APIs: -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!--
 To retrieve OAuth 2.0 tokens or invalidate tokens to disconnect a user. This disconnect
     option is required to comply with the Google+ Sign-In developer policies
    -->
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    <!-- To retrieve the account name (email) as part of sign-in: -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <!-- To auto-complete the email text field in the login form with the user's emails -->
    <uses-permission android:name="android.permission.READ_PROFILE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />

    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="18" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission
        android:name="android.permission.READ_EXTERNAL_STORAGE"
        android:maxSdkVersion="18" />



    <!-- Recommended by us and most bundled integrations. -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <!-- Allow you to get LOGCAT information when a crash occurs. -->
    <uses-permission android:name="android.permission.READ_LOGS"/>

    <!-- Allow you to see which activity was active when a crash occurs. -->
    <uses-permission android:name="android.permission.GET_TASKS"/>

    <!-- Allows location to be tracked -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

    <!-- Required by leanplum (and for push notifications) -->
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>

    <!-- End segment io recommended permissions -->

    <permission
        android:name="com.gmspartners.earthmiles.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.gmspartners.earthmiles.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />


    <application
        android:name="com.gmspartners.earthmiles.globalstate.App"
        android:allowBackup="true"

        android:label="@string/app_name"
        android:icon="@drawable/earthmiles_logo_green"
        android:logo="@drawable/earthmiles_logo_white_actionbar"
        android:screenOrientation="portrait"

        android:theme="@style/Theme.Emgreen_actionbar"
        tools:replace="android:icon" >


        <activity
            android:name="com.gmspartners.earthmiles.views.MainActivity_"
            android:label="@string/app_name"
            android:screenOrientation="portrait">
        </activity>
        <activity
            android:name="com.gmspartners.earthmiles.views.ActivityLanding_"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name="com.gmspartners.earthmiles.views.ActivitySignIn_"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:windowSoftInputMode="adjustPan"
            />


        <receiver
            android:name="com.gmspartners.earthmiles.pushnotification.GcmBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="com.earthmileslftr.earthmiles" />
            </intent-filter>
        </receiver>

        <service android:name="com.gmspartners.earthmiles.pushnotification.GCMNotificationIntentService" />

    </application>

</manifest>

回答1:


In my case I found this error on LogCat

Failed to validate the certificate chain, error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

So I checked the server certificates in this web to see what happens: https://www.ssllabs.com/ssltest

So should be a server problem



来源:https://stackoverflow.com/questions/28011632/no-internet-access-in-signed-apk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!