这是logcat的详细信息
06-23 09:52:14.298 4539-4539/com.company.app.CallingAmbulanceforDrivers E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.company.app.CallingAmbulanceforDrivers, PID: 4539
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.company.app.CallingAmbulanceforDrivers/com.company.app.CallingAmbulanceforDrivers.Drivermap}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.company.app.CallingAmbulanceforDrivers.Drivermap.onCreate(Drivermap.java:11)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: java.lang.RuntimeException: API key not found. Check that <meta-data android:name="com.google.android.geo.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
at com.google.maps.api.android.lib6.drd.q.b(:com.google.android.gms.dynamite_dynamitemodulesb@12521014@12.5.21 (020800-189987672):40)
at com.google.maps.api.android.lib6.auth.e.a(:com.google.android.gms.dynamite_dynamitemodulesb@12521014@12.5.21 (020800-189987672):11)
at com.google.maps.api.android.lib6.impl.e.a(:com.google.android.gms.dynamite_dynamitemodulesb@12521014@12.5.21 (020800-189987672):4)
at com.google.android.gms.maps.internal.b.a(:com.google.android.gms.dynamite_dynamitemodulesb@12521014@12.5.21 (020800-189987672):24)
at com.google.android.gms.maps.internal.CreatorImpl.a(:com.google.android.gms.dynamite_dynamitemodulesb@12521014@12.5.21 (020800-189987672):69)
at com.google.android.gms.maps.internal.CreatorImpl.newMapFragmentDelegate(:com.google.android.gms.dynamite_dynamitemodulesb@12521014@12.5.21 (020800-189987672):32)
at com.google.android.gms.maps.internal.i.onTransact(:com.google.android.gms.dynamite_dynamitemodulesb@12521014@12.5.21 (020800-189987672):32)
at android.os.Binder.transact(Binder.java:380)
at byb.a(:com.google.android.gms@12521014@12.5.21 (020800-189987672):2)
at yzr.newMapFragmentDelegate(:com.google.android.gms@12521014@12.5.21 (020800-189987672):1)
at com.google.android.gms.maps.internal.CreatorImpl.newMapFragmentDelegate(:com.google.android.gms@12521014@12.5.21 (020800-189987672):2)
at yzq.onTransact(:com.google.android.gms@12521014@12.5.21 (020800-189987672):12)
at android.os.Binder.transact(Binder.java:380)
at com.google.android.gms.internal.zzed.zza(Unknown Source)
at com.google.android.gms.maps.internal.zzf.zzH(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zzwg(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.on
答案 0 :(得分:0)
Java.lang.RuntimeException: API key not found. Check that is in the element of AndroidManifest.xml at ....
清单中似乎缺少必需的值(API密钥)。
答案 1 :(得分:0)
Api键未在清单文件中定义。 请在清单文件中输入必需的值,例如Api键。
答案 2 :(得分:0)
您在应用中使用google maps API。 https://developers.google.com/maps/documentation/android-sdk/signup
您必须在manifest.xml中添加API密钥
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY"/>
检查链接,您会发现解决方案非常简单!