我已经尝试了大约一百万件事来修复这张地图,但我不能为我的生活做准备。在我的应用程序中,我有一个按钮可以在本地打开地图,每次按下它都会崩溃。
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.jayster.jayster_app.MapsActivity" />
package com.jayster.jayster_app;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.jayster.proto_jayster.R;
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
}
}
这是catlog
:
07-25 19:06:03.427 12487-12487/com.jayster.proto_jayster W/System: ClassLoader referenced unknown path: /data/app/com.jayster.proto_jayster-2/lib/x86
07-25 19:06:03.463 12487-12487/com.jayster.proto_jayster
I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
07-25 19:06:03.464 12487-12487/com.jayster.proto_jayster I/InstantRun: starting instant run server: is main process
07-25 19:06:03.863 12487-12487/com.jayster.proto_jayster E/Jayster: Bluetooth LE not supported
07-25 19:06:03.863 12487-12487/com.jayster.proto_jayster E/BluetoothAdapter: Bluetooth binder is null
07-25 19:06:06.897 12487-12487/com.jayster.proto_jayster D/gralloc_ranchu: Emulator without host-side GPU emulation detected. Loading gralloc.default.so from /vendor/lib/hw/gralloc.default.so...
07-25 19:06:06.897 12487-12487/com.jayster.proto_jayster D/gralloc_ranchu: gralloc.default.so not found in /vendor. Trying /system/lib/hw/gralloc.default.so...
07-25 19:06:06.941 12487-12564/com.jayster.proto_jayster I/OpenGLRenderer: Initialized EGL, version 1.4
07-25 19:06:06.941 12487-12564/com.jayster.proto_jayster D/OpenGLRenderer: Swap behavior 1
07-25 19:06:06.933 12487-12487/com.jayster.proto_jayster W/RenderThread: type=1400 audit(0.0:215): avc: denied { search } for name="graphics" dev="tmpfs" ino=4274 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:graphics_device:s0 tclass=dir permissive=0
07-25 19:06:07.871 12487-12487/com.jayster.proto_jayster I/Choreographer: Skipped 53 frames! The application may be doing too much work on its main thread.
07-25 19:06:20.070 12487-12487/com.jayster.proto_jayster I/zzbx: Making Creator dynamically
07-25 19:06:20.087 12487-12487/com.jayster.proto_jayster W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
07-25 19:06:20.099 12487-12487/com.jayster.proto_jayster W/System: ClassLoader referenced unknown path:
07-25 19:06:20.099 12487-12487/com.jayster.proto_jayster W/System: ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
07-25 19:06:20.136 12487-12487/com.jayster.proto_jayster I/Google Maps Android API: Google Play services client version: 11020000
07-25 19:06:20.139 12487-12487/com.jayster.proto_jayster I/Google Maps Android API: Google Play services package version: 11055470
07-25 19:06:20.196 12487-12487/com.jayster.proto_jayster D/AndroidRuntime: Shutting down VM
07-25 19:06:20.197 12487-12487/com.jayster.proto_jayster E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.jayster.proto_jayster, PID: 12487
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jayster.proto_jayster/com.jayster.jayster_app.MapsActivity}: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
Caused by: java.lang.RuntimeException: The API key can only be specified once. It is recommended that you use the meta-data tag with the name: com.google.android.geo.API_KEY in the <application> element of AndroidManifest.xml
at com.google.maps.api.android.lib6.drd.q.b(:com.google.android.gms.DynamiteModulesB:37)
at com.google.maps.api.android.lib6.auth.e.a(:com.google.android.gms.DynamiteModulesB:12)
at com.google.android.gms.maps.internal.CreatorImpl.a(:com.google.android.gms.DynamiteModulesB:121)
at com.google.android.gms.maps.internal.CreatorImpl.newMapFragmentDelegate(:com.google.android.gms.DynamiteModulesB:25)
at com.google.android.gms.maps.internal.g.onTransact(:com.google.android.gms.DynamiteModulesB:35)
at android.os.Binder.transact(Binder.java:499)
at uni.newMapFragmentDelegate(:com.google.android.gms:1)
at com.google.android.gms.maps.internal.CreatorImpl.newMapFragmentDelegate(:com.google.android.gms:1)
at unh.onTransact(:com.google.android.gms:13)
at android.os.Binder.transact(Binder.java:499)
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.onInflate(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
at android.support.v4.app.Fragment.onInflate(Fragment.java:1184)
at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3439)
at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:120)
at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:378)
at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:33)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:79)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:777)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:414)
at android.app.Activity.setContentView(Activity.java:2414)
at com.jayster.jayster_app.MapsActivity.onCreate(MapsActivity.java:19)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
07-25 19:06:20.197 12487-12487/com.jayster.proto_jayster E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
07-25 19:10:33.736 12487-12494/com.jayster.proto_jayster W/art: Suspending all threads took: 9.787ms