在签署的APK无法上网 [英] No internet access in signed APK
问题描述
我工作那是在调试内部版本工作正常的应用程序,然后使用我创建密钥库签署的APK,然后与Android工作室 - >生成APK签署
当我通过下载到我的手机手动安装APK签约,它要求所有的权限,包括互联网接入。但是安装后,应用程序启动,但没有调用服务器的/ API调用工作。这款手机拥有互联网连接,但(在网页浏览器中打开)
我的Android清单是:
<?XML版本=1.0编码=UTF-8&GT?;
<清单的xmlns:机器人=http://schemas.android.com/apk/res/android
的xmlns:工具=http://schemas.android.com/tools
包=com.gmspartners.earthmiles>
!< - 使用Google+的API: - >
<使用许可权的android:NAME =android.permission.INTERNET对/>
<! -
要检索的OAuth 2.0令牌或无效令牌断开连接的用户。这种脱节
选项是必须遵守Google+登录的开发者政策
- >
<使用许可权的android:NAME =android.permission.USE_CREDENTIALS/>
!< - 要检索的帐户名(电子邮件)作为登录的一部分: - >
<使用许可权的android:NAME =android.permission.GET_ACCOUNTS/>
<! - 自动完成登录表单中的电子邮件文本字段与用户的电子邮件 - >
<使用许可权的android:NAME =android.permission.READ_PROFILE/>
<使用许可权的android:NAME =android.permission.READ_CONTACTS/> <使用许可权
机器人:名字=android.permission.WRITE_EXTERNAL_STORAGE
机器人:maxSdkVersion =18/>
<使用许可权的android:NAME =android.permission.READ_PHONE_STATE/>
<使用许可权
机器人:名字=android.permission.READ_EXTERNAL_STORAGE
机器人:maxSdkVersion =18/> <! - 由我们推荐最捆绑的集成。 - >
<使用许可权的android:NAME =android.permission.ACCESS_NETWORK_STATE/> <! - 允许在发生崩溃时,你得到的信息logcat中。 - >
<使用许可权的android:NAME =android.permission.READ_LOGS/> <! - 让你看到,当碰撞发生时的活动明显活跃。 - >
<使用许可权的android:NAME =android.permission.GET_TASKS/> &所述;! - 允许位置被跟踪 - >
<使用许可权的android:NAME =android.permission.ACCESS_COARSE_LOCATION/>
<使用许可权的android:NAME =android.permission.ACCESS_FINE_LOCATION/> <! - 由leanplum必需(和推送通知) - GT;
<使用许可权的android:NAME =com.google.android.c2dm.permission.RECEIVE/> <! - 结束段IO推荐的权限 - > <许可
机器人:名字=com.gmspartners.earthmiles.permission.C2D_MESSAGE
安卓的ProtectionLevel =签名/> <使用许可权的android:NAME =com.gmspartners.earthmiles.permission.C2D_MESSAGE/>
<使用许可权的android:NAME =com.google.android.c2dm.permission.RECEIVE/>
<使用许可权的android:NAME =android.permission.VIBRATE/>
<使用许可权的android:NAME =android.permission.WAKE_LOCK/>
<应用
机器人:名字=com.gmspartners.earthmiles.globalstate.App
机器人:allowBackup =真 机器人:标签=@字符串/ APP_NAME
机器人:图标=@绘制/ earthmiles_logo_green
机器人:标志=@绘制/ earthmiles_logo_white_actionbar
机器人:screenOrientation =画像 机器人:主题=@风格/ Theme.Emgreen_actionbar
工具:更换=安卓图标>
<活动
机器人:名字=com.gmspartners.earthmiles.views.MainActivity_
机器人:标签=@字符串/ APP_NAME
机器人:screenOrientation =肖像>
< /活性GT;
<活动
机器人:名字=com.gmspartners.earthmiles.views.ActivityLanding_
机器人:标签=@字符串/ APP_NAME
机器人:screenOrientation =画像
机器人:主题=@安卓风格/ Theme.NoTitleBar.Fullscreen
> &所述;意图滤光器>
<作用机器人:名字=android.intent.action.MAIN/> <类机器人:名字=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT; <活动
机器人:名字=com.gmspartners.earthmiles.views.ActivitySignIn_
机器人:标签=@字符串/ APP_NAME
机器人:screenOrientation =画像
机器人:configChanges =方向| keyboardHidden |屏幕尺寸
机器人:windowSoftInputMode =adjustPan
/>
<接收
机器人:名字=com.gmspartners.earthmiles.pushnotification.GcmBroadcastReceiver
机器人:权限=com.google.android.c2dm.permission.SEND>
&所述;意图滤光器>
<作用机器人:名字=com.google.android.c2dm.intent.RECEIVE/>
<作用机器人:名字=com.google.android.c2dm.intent.REGISTRATION/> <类机器人:名字=com.earthmileslftr.earthmiles/>
&所述; /意图滤光器>
< /接收器> <服务机器人:名字=com.gmspartners.earthmiles.pushnotification.GCMNotificationIntentService/> < /用途>< /清单>
在我的情况,我发现这个错误的LogCat中
无法验证证书链,错误:java.security.cert.CertPathValidatorException:信任锚证书路径没有找到。
所以,我检查了服务器证书在这个网站,看看会发生什么: https://www.ssllabs.com/ ssltest
所以,应该是一个服务器的问题。
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>
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
这篇关于在签署的APK无法上网的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!