我的Google地图活动有问题......我收到安装错误错误:INSTALL_PARSE_FAILED_MANIFEST_MALFORMED ........以下Google地图活动代码....... ......
package com.tommy.maps;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class Main extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.e("key", "ok");
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.e("key", "ok2");
}
}
布局中的xml文件
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
的AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tommy.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<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="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name="com.tommy.maps.Main"
android:label="@string/app_name" >
<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="API_KEY" />
<meta-data>
</meta-data>
</application>
</manifest>
我已经发布了清单和xml代码以及java代码......请告诉我我的错误并告诉我该怎么办错误...... 我的日志消息是: -
12-26 15:06:00.160: I/Choreographer(546): Skipped 31 frames! The application may be doing too much work on its main thread.
12-26 15:06:00.330: I/Choreographer(546): Skipped 52 frames! The application may be doing too much work on its main thread.
12-26 15:06:00.600: I/Choreographer(546): Skipped 80 frames! The application may be doing too much work on its main thread.
12-26 15:06:01.361: D/AndroidRuntime(1480): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
12-26 15:06:01.361: D/AndroidRuntime(1480): CheckJNI is ON
12-26 15:06:01.470: D/dalvikvm(1480): Trying to load lib libjavacore.so 0x0
12-26 15:06:01.490: D/dalvikvm(1480): Added shared lib libjavacore.so 0x0
12-26 15:06:01.590: D/dalvikvm(1480): Trying to load lib libnativehelper.so 0x0
12-26 15:06:01.590: D/dalvikvm(1480): Added shared lib libnativehelper.so 0x0
12-26 15:06:01.770: E/cutils-trace(1480): Error opening trace file: No such file or directory (2)
答案 0 :(得分:0)
由于您的最低api级别为8,因此您的xml文件中除了SupportMapFragment
之外还需要MapFragment
。更改您的布局如下:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
在MainActivity
FragmentActivity
以外Activity
,如下所示:
public class Main extends FragmentActivity{
答案 1 :(得分:-1)
尝试将其放在xml文件中:<fragment....../>
甚至尝试生成api密钥尝试放置它....
甚至
只需删除“gen”文件夹即可。它自动构建。 申请工作正常。