Google지도 V2를 Android 프로젝트의 내 프로젝트에 통합하려고합니다. Google 재생 서비스를 build.gradle 파일의 종속 파일로 아래에 추가했습니다 :이진 XML 파일 - Google지도 V2 (Android Studio)의 클래스 조각을 부 풀리는 오류
내보기 레이아웃에서<permission android:name="app.me.locationalarm.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="app.me.locationalarm.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Required to show current location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Required OpenGL ES 2.0. for Maps V2 -->
<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=".HomeActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="MY_API_KEY" />
</manifest>
내가 조각을 추가 : 다음과 같이
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.google.android.gms:play-services:6.1.71'
}
나는 또한 나의 의 AndroidManifest.xml 파일을 변경했습니다.
private void createMapView(){
try {
if(null == googleMap){
googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.mapView)).getMap();
if(null == googleMap) {
Toast.makeText(getApplicationContext(),
"Error creating map", Toast.LENGTH_SHORT).show();
}
}
} catch (NullPointerException exception){
Log.e("mapApp", exception.toString());
}
}
내에서 OnCreate 방법에서이 방법을 전화 : 내 활동에
<fragment
android:id="@+id/mapView"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
나는 아래와 같은 방법 createMapView을 만들 수 있습니다.
FATAL EXCEPTION: main
Process: app.me.locationalarm, PID: 18446
java.lang.RuntimeException: Unable to start activity ComponentInfo{app.me.locationalarm/app.me.locationalarm.HomeActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
내 목표 SdkVersion 내가 그것을 해결할 수있는 방법을 21.Any의 생각이다 : 내 프로젝트를 실행하려고 할 때, 그 같은 오류를 발견? 나는 약간의 해답을 찾았지만 이것들 중 어느 것도 나를 도울 수 없다.
시도 : 안드로이드 : 이름 = "pl.mg6.android.maps.extensions.SupportMapFragment" –
활동에 어떤 변화가? 나는 Activityfiles에서 Mapfragment를 가져 갔다. – nutboltu
pl.mg6.android.maps.extensions.SupportMapFragment를 확인할 수 없음을 보여줍니다. – nutboltu