我有问题。我正在尝试添加到我的应用程序Google作为一个新的活动。我已经修改了很多次我的代码,但是当我想打开包含Google的活动时,我的应用程序正在关闭。
我正在使用Android,并在Huwei上测试我的应用程序。
也许有人会有什么主意。
Logcat (当我尝试打开Google的活动时):
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文件:
<?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();
}
}问题解决了!在评论中探索!
发布于 2014-12-30 21:35:59
您可以通过以下方式更新代码来解决此问题:
希望这会有帮助!!
https://stackoverflow.com/questions/27672793
复制相似问题