从APK安装的时候谷歌地图不可见 [英] Google maps not visible when installed from apk
问题描述
当我安装Android APK文件那么谷歌地图是不可见的,但是当我从Eclipse中运行相同的code,那么地图是可见的。我已在Android menifest文件中的所有权限。
这是我的menifest文件 -
<?XML版本=1.0编码=UTF-8&GT?;
<清单的xmlns:机器人=http://schemas.android.com/apk/res/android
包=com.majhe.android
安卓版code =1
机器人:=的versionName1.0><用途-SDK
安卓的minSdkVersion =14
机器人:targetSdkVersion =19/>&所述;! - 所需要的检索地图数据权限 - >
<使用许可权的android:NAME =android.permission.INTERNET对/>
<使用许可权的android:NAME =android.permission.WRITE_EXTERNAL_STORAGE/>
<使用许可权的android:NAME =com.google.android.providers.gsf.permission.READ_GSERVICES/>
<使用许可权的android:NAME =android.permission.ACCESS_NETWORK_STATE/><! - 建议使用地图和定位服务的权限 - >
<使用许可权的android:NAME =android.permission.ACCESS_COARSE_LOCATION/>
<使用许可权的android:NAME =android.permission.ACCESS_FINE_LOCATION/>
<使用许可权的android:NAME =android.permission.SEND_SMS/>
<使用许可权的android:NAME =android.permission.CALL_PHONE/>
<使用许可权的android:NAME =android.permission.READ_CONTACTS/>
<使用许可权的android:NAME =com.android.alarm.permission.SET_ALARM/>
<使用许可权的android:NAME =android.permission.WRITE_SETTINGS/>< - 建议:如果不支持的Open GL的要求的水平prevents应用程序安装 - >
<用途特征
机器人:glEsVersion =0x00020000
机器人:要求=真/><应用
机器人:allowBackup =真
机器人:图标=@绘制/ ic_launcher
机器人:标签=@字符串/ APP_NAME
机器人:主题=@风格/ AppTheme>
<活动
机器人:名字=com.majhe.android.LoginActivity
机器人:标签=@字符串/ title_activity_login
机器人:screenOrientation =画像
机器人:windowSoftInputMode =stateHidden | adjustResize>
< /活性GT;
<活动
机器人:名字=com.majhe.android.HomeActivity
机器人:标签=@字符串/ title_activity_home
机器人:screenOrientation =肖像>
< /活性GT;
<活动
机器人:名字=com.majhe.android.EditProfileActivity
机器人:标签=@字符串/ title_activity_edit_profile
机器人:parentActivityName =com.majhe.android.HomeActivity
机器人:screenOrientation =画像
机器人:windowSoftInputMode =stateHidden>
< /活性GT;
<活动
机器人:名字=com.majhe.android.EmergencyContactsActivity
机器人:标签=@字符串/ title_activity_emergency_contacts
机器人:parentActivityName =com.majhe.android.HomeActivity
机器人:screenOrientation =肖像>
< /活性GT;
<活动
机器人:名字=com.majhe.android.IntroScreenSlide
机器人:标签=Majhe V1.2
机器人:parentActivityName =com.majhe.android.HomeActivity
机器人:screenOrientation =画像
机器人:windowSoftInputMode =stateHidden | adjustResize>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.MAIN/> <类机器人:名字=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT; &所述;元数据
机器人:名字=com.google.android.maps.v2.API_KEY
机器人:值=AIzaSyAS0_nm-fW_Wu7pNjxM3G2w9FxK_hbsCsI/>
&所述;元数据
机器人:名字=com.google.android.gms.version
机器人:值=@整数/ GOOGLE_PLAY_SERVICES_VERSION/>
< /用途>
1)创建SHA-1为您的签名密钥。
签署您的应用程序Eclipse调试键可以在USERHOME / .android / debug.keystore文件中找到。如)C:\\用户\\零pc43.android \\ debug.keystore-----> C:\\ Program Files文件\\的Java \\ jdk1.7.0_01 \\ BIN \\ keytool.exe的-v -list -alias androiddebugkey -keystoreC:\\用户\\信息1234 \\ .android \\ debug.keystore-storepass
Android的安卓-keypass
例)
C:\\ Program Files文件\\的Java \\ jdk1.7.0_01 \\ BIN> keytool.exe的-v -list -alias androiddebugkey -keystoreC:\\用户\\零pc43 \\ .android \\ DEB
ug.keystore-storepass的android -keypass android的
别名:androiddebugkey
创建日期:2013年4月4日
条目类型:PrivateKeyEntry
证书链长:1
证书[1]:
业主:CN = Android的调试,O =机器人,C = US
发行人:CN = Android的调试,O =机器人,C = US
编号:4a5b5c6d
有效期从:周四4月4日18时33分13秒IST 2013至:星期六03月28日18时33分13秒IST 2043
证书指纹:
MD5:51:CE:5C:07:05:31:98:6A:D5:7C:24:B1:B3:EC:22:A3
SHA1:B2:68:A7:D6:3A:FC:8F:15:8D:3E:1F:4A:E8:99:CE:8D:F5:28:07:4D
SHA256:5B:5B:FE:7B:92:7F:06:53:1E:28:BB:D0:E5:CB:05:46:B0:81:76:CC:61:87:97:FA: 19:68:B6:C1:08:E8:D6:D9
签名算法名:SHA256withRSA
版本:3
2)与谷歌的API控制台注册
-----> HTTPS://$c$c.google.com/apis/console/
---->转到服务
然后激活(ON)的谷歌地图API的Android V2。
3)为应用程序创建键
----->选择API访问
**您以后需要通过其在该控制台软件包来注册您的应用程序一起
与你的签名密钥的SHA-1指纹。为此,选择条目并
点击API访问进入。然后点击创建新的Android按键......条目。**----->点击创建新的Android KEY
----->输入您的SHA-1指纹和你用分号隔开应用程序的软件包。 例如,你可以使用com.example.mymaps包。 (您的SHA-1键;包名称)
4)根据下面的链接改变你的Manifist.xml和JAVA文件
----->请Reffer此链接
http://www.vogella.com/articles/AndroidGoogleMaps/article.html
5)现在,创建新的密钥存储文件和APK文件为您的项目。
-----> C:\\ Program Files文件\\的Java \\ jdk1.7.0_01 \\ BIN>有密钥工具-list -alias你的别名-keystore路径侑应用keystor文件
输入密钥库密码:<您的密钥存储的制造&gt pasword;
mapExample,2013年4月18日,PrivateKeyEntry,
证书指纹(SHA1):71:EF:B0:6A:A8:BG:E5:61:E9:23:D0:F2:1E:9D:D0:6F:A4:70:0F:A9----->现在你有了新的SHA-1键
----->有了这个SHA-1键,按照步骤4号
6)现在,您将获得新的谷歌地图API KEY
现在到Manifeast.xml文件中使用此键(如图STEM NO 4)&所述;元数据
机器人:名字=com.google.android.maps.v2.API_KEY
机器人:值=NEW GOOGLE MAP API KEY/>
7)现在,创建新的APK文件的您使用APLICATION现有的密钥库。
When I install android apk file then the google map is not visible but when I run the same code from eclipse then maps are visible. I have given all the permissions in the android menifest file.
This is my menifest file-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.majhe.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<!-- Permissions that are required for retrieving map data -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Permissions that are recommended for using map and location services -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<!-- Recommended: prevents app installation if required level of Open GL is not supported -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.majhe.android.LoginActivity"
android:label="@string/title_activity_login"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" >
</activity>
<activity
android:name="com.majhe.android.HomeActivity"
android:label="@string/title_activity_home"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.majhe.android.EditProfileActivity"
android:label="@string/title_activity_edit_profile"
android:parentActivityName="com.majhe.android.HomeActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name="com.majhe.android.EmergencyContactsActivity"
android:label="@string/title_activity_emergency_contacts"
android:parentActivityName="com.majhe.android.HomeActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.majhe.android.IntroScreenSlide"
android:label="Majhe v1.2"
android:parentActivityName="com.majhe.android.HomeActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAS0_nm-fW_Wu7pNjxM3G2w9FxK_hbsCsI" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
1)Creating the SHA-1 for your signature key.
The Eclipse debug key for signing your application can be found in the userhome/.android/debug.keystore file. eg) C:\Users\nil pc43.android\debug.keystore
-----> C:\Program Files\Java\jdk1.7.0_01\bin\keytool.exe -v -list -alias androiddebugkey -keystore "C:\Users\Info 1234\.android\debug.keystore" -storepass
android -keypass android
Example)
C:\Program Files\Java\jdk1.7.0_01\bin>keytool.exe -v -list -alias androiddebugkey -keystore "c:\Users\nil pc43\.android\deb
ug.keystore" -storepass android -keypass android
Alias name: androiddebugkey
Creation date: Apr 4, 2013
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 4a5b5c6d
Valid from: Thu Apr 04 18:33:13 IST 2013 until: Sat Mar 28 18:33:13 IST 2043
Certificate fingerprints:
MD5: 51:CE:5C:07:05:31:98:6A:D5:7C:24:B1:B3:EC:22:A3
SHA1: B2:68:A7:D6:3A:FC:8F:15:8D:3E:1F:4A:E8:99:CE:8D:F5:28:07:4D
SHA256: 5B:5B:FE:7B:92:7F:06:53:1E:28:BB:D0:E5:CB:05:46:B0:81:76:CC:61:87:97:FA:19:68:B6:C1:08:E8:D6:D9
Signature algorithm name: SHA256withRSA
Version: 3
2)Register with the Google APIs Console
-----> https://code.google.com/apis/console/
----> Go to Services
Then Activate(ON) the Google Maps Android API v2.
3)Create key for your application
-----> sELECT API ACCESS
**You need later to register your application via its package in this console together
with the SHA-1 fingerprint of your signature key. For this you select the entry and
click on the API Access entry. Afterwards click on the Create new Android key...entry.**
-----> Click on "Create New Android KEY"
-----> Enter your SHA-1 fingerprint and the package of your application separated by a semicolon.
For example you can use the com.example.mymaps package. (your SHA-1 key;package Name)
4)Change Your Manifist.xml and JAVA File according below link
-----> please Reffer this Link
http://www.vogella.com/articles/AndroidGoogleMaps/article.html
5)Now Create new KeyStore File and APK file For your project.
----->C:\Program Files\Java\jdk1.7.0_01\bin>keytool -list -alias "your alias name" -keystore "path that have keystor file of yor application"
Enter keystore password: <pasword of your keystore>
mapExample, Apr 18, 2013, PrivateKeyEntry,
Certificate fingerprint (SHA1): 71:EF:B0:6A:A8:BG:E5:61:E9:23:D0:F2:1E:9D:D0:6F:A4:70:0F:A9
-----> Now you have new SHA-1 KEY
-----> With this SHA-1 KEY, Follow the Step no 4
6)Now you will get NEW google map API KEY
Now use this key in to Manifeast.xml file (AS SHOWN IN STEM NO 4)
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="NEW GOOGLE MAP API KEY" />
7)Now Create New APK FILE of you APLICATION with the use the existing keystore.
这篇关于从APK安装的时候谷歌地图不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!