2017-03-24 8 views
0

입니다. MapActivity를 사용하는 앱을 개발했습니다. 내 AVD에서 내 실제 장치에Google지도는 작동하지만 MapFragment는

(갤럭시 : 나는 ...

내 문제를 매니페스트에 API-KEY를 연결하고 구글은 Gradle을 10.2.0에서지도 서비스를 재생 사용 미안했다 s6 with Nougat, Android 7)지도를 볼 수 있으며 올바르게로드됩니다. 하지만 일부 장치에서는 그렇지 않습니다. 왜 그런지 모르겠습니다. 물론 동일한 API 키. supportMapFragment를 사용하고 있습니다.

예를 들어 이러한 휴대 전화의 경우지도는 왼쪽 하단의 Google 로고와 함께 회색으로 유지됩니다. 4.03와

enter image description here

갤럭시 S3에도

enter image description here

enter image description here와는 작업을 나던 4.1.1. Xiaomi Mi MAX에서 작동합니다.

매니페스트

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="ibas.locatixteamviewer"> 

<!-- 
    The ACCESS_COARSE/FINE_LOCATION permissions are not required to use 
    Google Maps Android API v2, but you must specify either coarse or fine 
    location permissions for the 'MyLocation' functionality. 
--> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
<!-- 
    The ACCESS_COARSE/FINE_LOCATION permissions are not required to use 
    Google Maps Android API v2, but you must specify either coarse or fine 
    location permissions for the 'MyLocation' functionality. 
--> 
<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 

    <!-- 
     The API key for Google Maps-based APIs is defined as a string resource. 
     (See the file "res/values/google_maps_api.xml"). 
     Note that the API key is linked to the encryption key used to sign the APK. 
     You need a different API key for each encryption key, including the release key that is used to 
     sign the APK for publishing. 
     You can define the keys for the debug and release targets in src/debug/ and src/release/. 
    --> 
    <meta-data 
     android:name="com.google.android.geo.API_KEY" 
     android:value="@string/google_maps_key" /> 

    <activity 
     android:name=".MapsActivity" 
     android:label="@string/title_activity_maps"></activity> 
    <activity 
     android:name=".MainActivity" 
     android:label="@string/app_name" 
     android:noHistory="true" 
     android:theme="@style/AppTheme.NoActionBar"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name=".ListActivity" 
     android:label="@string/title_activity_list" 
     android:theme="@style/AppTheme.NoActionBar" /> 
    <activity 
     android:name=".FahrzeugActivity" 
     android:label="@string/title_activity_fahrzeug" 
     android:theme="@style/AppTheme.NoActionBar" /> 
    <activity 
     android:name=".WebActivity" 
     android:label="@string/title_activity_web" 
     android:theme="@style/AppTheme.NoActionBar" /> 
    <activity 
     android:name=".ListMapsActivity" 
     android:label="@string/title_activity_list_maps"></activity> 
</application> 

activity_maps.xml

<fragment xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:map="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/map" 
android:name="com.google.android.gms.maps.SupportMapFragment" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="ibas.locatixteamviewer.MapsActivity"> 

<!--<Button--> 
    <!--android:id="@+id/button1"--> 
    <!--android:layout_width="wrap_content"--> 
    <!--android:layout_height="wrap_content"--> 
    <!--android:background="#359c5e"--> 
    <!--android:layout_alignParentTop="true"--> 
    <!--android:layout_alignParentEnd="true"--> 
    <!--android:padding="8dp"--> 
    <!--android:layout_margin="5dp"--> 
    <!--android:src="@drawable/menu_car_side_7_white"--> 
    <!--android:textColor="#ffffff" />--> 

</fragment> 

Gradle을

compile 'com.android.support:appcompat-v7:25.2.0' 
compile 'com.google.android.gms:play-services-maps:10.2.0' 
compile 'com.android.support:design:25.2.0' 
compile 'com.android.volley:volley:1.0.0' 
compile 'com.android.support:recyclerview-v7:25.2.0' 
testCompile 'junit:junit:4.12' 

}

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    defaultConfig { 
     applicationId "ibas.locatixteamviewer" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
+0

Di d 설치된 앱 버전이 앱에서 사용하는 버전과 맞는지 확인합니다. 어떤 장치에서는 최신이 아닐 수도 있습니다. – nicopico

답변

0

그렇지 않은 잎파리가 모바일 설정에서 위치 서비스에 대한 <application> 태그

<uses-feature 
android:glEsVersion="0x00020000" 
android:required="true" /> 

<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> 
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
+0

죄송 합니다만 여전히 작동하지 않습니다. 다른 아이디어? – skm

+0

'uses-permission'은 온타리오''태그 여야합니다 ** 안이나 안, 아니요? –

+0

예. '' 태그의 맨 위에 있어야합니다. – rafsanahmad007

0

확인 응용 프로그램 권한의 매니페스트 상단이 추가 허용 된 다음 위치를 허용 한 다음 앱을 다시 시작하십시오.