문제가 있습니다. 내 앱인 Google지도를 새로운 활동으로 추가하려고합니다. 내 코드를 여러 번 변경했지만 Google지도가 포함 된 활동을 켜기 원할 때도 내 앱이 종료됩니다.다른 활동으로 앱에 Google지도 추가
Android Studio를 사용 중이며 Huwei Ascand에서 내 앱을 테스트하고 있습니다.
누군가가 어떤 아이디어를 가지고 있을지도 모릅니다.
12-28 01:19:30.894 28452-28452/com.example.user.elderly2 W/dalvikvm﹕ Refusing to reopen boot DEX '/system/framework/hwframework.jar'
12-28 01:19:31.014 28452-28452/com.example.user.elderly2 I/Google Maps Android API﹕ Google Play services client version: 6587000
12-28 01:19:31.024 28452-28452/com.example.user.elderly2 I/Google Maps Android API﹕ Google Play services package version: 6599034
12-28 01:19:31.234 28452-28455/com.example.user.elderly2 E/dalvikvm﹕ GC_CONCURRENT freed 2505K, 24% free 10764K/14019K, paused 12ms+3ms, total 53ms
12-28 01:19:31.284 28452-28455/com.example.user.elderly2 E/dalvikvm﹕ GC_CONCURRENT freed 810K, 20% free 11341K/14019K, paused 12ms+2ms, total 37ms
12-28 01:19:31.474 28452-28455/com.example.user.elderly2 E/dalvikvm﹕ GC_CONCURRENT freed 800K, 16% free 11822K/14019K, paused 12ms+14ms, total 77ms
12-28 01:19:31.675 28452-28455/com.example.user.elderly2 E/dalvikvm﹕ GC_CONCURRENT freed 400K, 12% free 12434K/14019K, paused 12ms+13ms, total 72ms
12-28 01:19:31.685 28452-28452/com.example.user.elderly2 W/System.err﹕ Invalid int: ""
12-28 01:19:31.815 28452-28455/com.example.user.elderly2 E/dalvikvm﹕ GC_CONCURRENT freed 576K, 10% free 12940K/14279K, paused 2ms+14ms, total 51ms
12-28 01:19:31.935 28452-28455/com.example.user.elderly2 E/dalvikvm﹕ GC_CONCURRENT freed 684K, 10% free 12982K/14407K, paused 2ms+2ms, total 48ms
12-28 01:19:31.995 28452-28452/com.example.user.elderly2 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40d2b438)
매니페스트 파일 :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.user.elderly2" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--
The following two permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<!-- End of copy. -->
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
//Main Activity
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
//Second activity from which I want to turn Google Maps
<activity
android:name=".Main_Menu_Activity"
android:label="@string/title_activity_main__menu_" >
<intent-filter>
<action android:name="com.example.user.elderly2.Main_Menu_Activity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
// activity with Google Maps
<activity
android:name=".Maps_Activity"
android:label="@string/title_activity_maps_" >
<intent-filter>
<action android:name="com.example.user.elderly2.Maps_Activity" />
<category android:name="android.intent.category.default.DEFAULT" />
</intent-filter>
</activity>
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaS************************TcfaQc"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
activity_maps.XML 파일 :
로그 캣 (순간에 나는 Google지도 활동에 회전을하려고 할 때)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:name="com.google.android.gms.maps.SupportMapFragment"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
Maps_activity.java :
package com.example.user.elderly2;
import com.google.android.gms.maps.*;
import com.google.android.gms.maps.model.*;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.SupportMapFragment;
import org.apache.http.HttpMessage;
public class Maps_Activity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps_);
GoogleMap mMap;
SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
mMap = fm.getMap();
}
}
과제를 해결한다! 의견의 설명!
'class = "com.google.android.gms.maps.SupportMapFragment"'를'android : name = "com.google.android.gms.maps.SupportMapFragment"'by'activity_maps.xml'로 바꾸어보세요. 차이가 있다면. 예 : [이 문서] (http://developer.android.com/guide/components/fragments.html#Adding). – stkent
약혼 해 주셔서 감사합니다.하지만 수정 후에도 여전히 동일한 상황입니다. ; –
또한,'setContentView (R.layout.activity_maps _);'에는 밑줄이 너무 많아서 보이지 않는 것 같습니다. – stkent