我正在使用google maps api v2开发一个简单的应用程序。我正确地将google-play-services_lib添加到项目中,我相信我的Manifest文件是正确的,但是我收到以下错误:
08-05 19:17:37.709: E/AndroidRuntime(7610): FATAL EXCEPTION: main
08-05 19:17:37.709: E/AndroidRuntime(7610): Process: com.example.unitygame7, PID: 7610
08-05 19:17:37.709: E/AndroidRuntime(7610): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
08-05 19:17:37.709: E/AndroidRuntime(7610): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:106)
08-05 19:17:37.709: E/AndroidRuntime(7610): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:57)
08-05 19:17:37.709: E/AndroidRuntime(7610): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:99)
08-05 19:17:37.709: E/AndroidRuntime(7610): at com.example.unitygame7.MainActivity.onCreate(MainActivity.java:17)
08-05 19:17:37.709: E/AndroidRuntime(7610): at android.app.Activity.performCreate(Activity.java:5248)
08-05 19:17:37.709: E/AndroidRuntime(7610): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
08-05 19:17:37.709: E/AndroidRuntime(7610): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
08-05 19:17:37.709: E/AndroidRuntime(7610): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
08-05 19:17:37.709: E/AndroidRuntime(7610): at android.app.ActivityThread.access$800(ActivityThread.java:139)
08-05 19:17:37.709: E/AndroidRuntime(7610): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
08-05 19:17:37.709: E/AndroidRuntime(7610): at android.os.Handler.dispatchMessage(Handler.java:102)
08-05 19:17:37.709: E/AndroidRuntime(7610): at android.os.Looper.loop(Looper.java:136)
08-05 19:17:37.709: E/AndroidRuntime(7610): at android.app.ActivityThread.main(ActivityThread.java:5102)
08-05 19:17:37.709: E/AndroidRuntime(7610): at java.lang.reflect.Method.invokeNative(Native Method)
08-05 19:17:37.709: E/AndroidRuntime(7610): at java.lang.reflect.Method.invoke(Method.java:515)
08-05 19:17:37.709: E/AndroidRuntime(7610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
08-05 19:17:37.709: E/AndroidRuntime(7610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
08-05 19:17:37.709: E/AndroidRuntime(7610): at dalvik.system.NativeStart.main(Native Method)
这是我的清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.unitygame7"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<uses-permission
android:name="android.permission.SEND_SMS"
android:maxSdkVersion="19" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
android:maxSdkVersion="19" />
<uses-permission
android:name="android.permission.INTERNET"
android:maxSdkVersion="19" />
<uses-permission
android:name="android.permission.NFC"
android:maxSdkVersion="19" />
<uses-permission
android:name="android.permission.WRITE_SOCIAL_STREAM"
android:maxSdkVersion="19" />
<uses-permission
android:name="android.permission.BATTERY_STATS"
android:maxSdkVersion="19" />
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"
android:maxSdkVersion="19" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="19" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:maxSdkVersion="19"/>
<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="com.example.unitygame7.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>
<activity
android:name="com.example.unitygame7.TrackingActivity"
android:label="@string/title_activity_tracking" >
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name="com.example.unitygame7.MapActivityty"
android:label="You're Awesome, Oak" >
</activity>
<uses-library android:name="com.google.android.maps" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCvTweV4Iv8VrXA90fAC6_y0_1UUcBiOco" />
</application>
答案 0 :(得分:0)
您需要参考Compat支持库。请查看Android Developer Center。
如果您使用的是Eclipse:
否则,如果您使用Android Studio:
在你的style.xml文件集上:android:theme =“@ style / Theme.AppCompat”。