我认为我的问题在于某些jar文件不在“dependency”文件夹中。我不知道如何解决这个问题,我已经删除了所有Google游戏服务的内容并重新添加了多次。
Here is the album of images使用我的包资源管理器,map.xml,map.java和manifest,都标记了。 (因为我不能发布超过2个链接或任何图像)
我的logcat(使用我的Android设备[v4.0.4],而不是模拟器):
06-11 11:30:57.858: E/AndroidRuntime(16661): FATAL EXCEPTION: main
06-11 11:30:57.858: E/AndroidRuntime(16661): java.lang.RuntimeException: Unable to
start activity ComponentInfo{com.example.playground/com.example.playground.Map}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.os.Handler.dispatchMessage(Handler.java:99)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.os.Looper.loop(Looper.java:137)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.app.ActivityThread.main(ActivityThread.java:4424)
06-11 11:30:57.858: E/AndroidRuntime(16661): at java.lang.reflect.Method.invokeNative(Native Method)
06-11 11:30:57.858: E/AndroidRuntime(16661): at java.lang.reflect.Method.invoke(Method.java:511)
06-11 11:30:57.858: E/AndroidRuntime(16661): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:812)
06-11 11:30:57.858: E/AndroidRuntime(16661): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:579)
06-11 11:30:57.858: E/AndroidRuntime(16661): at dalvik.system.NativeStart.main(Native Method)
06-11 11:30:57.858: E/AndroidRuntime(16661): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-11 11:30:57.858: E/AndroidRuntime(16661): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.app.Activity.setContentView(Activity.java:1835)
06-11 11:30:57.858: E/AndroidRuntime(16661): at com.example.playground.Map.onCreate(Map.java:12)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.app.Activity.performCreate(Activity.java:4465)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
06-11 11:30:57.858: E/AndroidRuntime(16661): ... 11 more
06-11 11:30:57.858: E/AndroidRuntime(16661): Caused by: java.lang.RuntimeException: API key not found. Check that <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
06-11 11:30:57.858: E/AndroidRuntime(16661): at maps.aj.ay.a(Unknown Source)
06-11 11:30:57.858: E/AndroidRuntime(16661): at maps.aj.ay.a(Unknown Source)
06-11 11:30:57.858: E/AndroidRuntime(16661): at maps.aj.al.a(Unknown Source)
06-11 11:30:57.858: E/AndroidRuntime(16661): at maps.aj.bf.a(Unknown Source)
06-11 11:30:57.858: E/AndroidRuntime(16661): at maps.aj.be.a(Unknown Source)
06-11 11:30:57.858: E/AndroidRuntime(16661): at bcw.onTransact(SourceFile:107)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.os.Binder.transact(Binder.java:297)
06-11 11:30:57.858: E/AndroidRuntime(16661): at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
06-11 11:30:57.858: E/AndroidRuntime(16661): at com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown Source)
06-11 11:30:57.858: E/AndroidRuntime(16661): at com.google.android.gms.internal.bb$4.b(Unknown Source)
06-11 11:30:57.858: E/AndroidRuntime(16661): at com.google.android.gms.internal.bb.a(Unknown Source)
06-11 11:30:57.858: E/AndroidRuntime(16661): at com.google.android.gms.internal.bb.onCreateView(Unknown Source)
06-11 11:30:57.858: E/AndroidRuntime(16661): at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:884)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1066)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1168)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:280)
06-11 11:30:57.858: E/AndroidRuntime(16661): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
06-11 11:30:57.858: E/AndroidRuntime(16661): ... 21 more
06-11 11:30:58.529: E/dalvikvm(16696): Could not find class 'android.telephony.CellInfo', referenced from method dmr.onCellInfoChanged
06-11 11:30:59.240: E/InputDispatcher(305): channel '41915cf8 com.example.playground/com.example.playground.Main (server)' ~ Channel is unrecoverably broken and will be disposed!
06-11 11:32:29.518: E/rmt_storage(97): rmt_storage write event
06-11 11:35:12.717: E/rmt_storage(97): rmt_storage write event
06-11 11:38:05.235: E/MipErrorService(17012): *** The argument of intent is null.
06-11 11:40:50.346: E/rmt_storage(97): rmt_storage write event
答案 0 :(得分:0)
如错误所示:
找不到API密钥。检查
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="your API key"/>
位于AndroidManifest.xml
的元素中所以你把钥匙放在Menifest文件中错误的位置。