Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“地图”活动中android studio emulator中的应用程序崩溃_Android_Google Maps - Fatal编程技术网

“地图”活动中android studio emulator中的应用程序崩溃

“地图”活动中android studio emulator中的应用程序崩溃,android,google-maps,Android,Google Maps,我在android studio中创建了一个google地图活动。我还从给定的链接生成了一个api密钥,并将其放置在适当的位置。但当我运行应用程序时,它会崩溃而不显示任何内容。这是航海日志 2018-12-19 16:13:00.080 17295-17295/? I/ik7.locationap: Not late-enabling -Xcheck:jni (already on) 2018-12-19 16:13:00.312 17295-17295/? W/ik7.locationap:

我在android studio中创建了一个google地图活动。我还从给定的链接生成了一个api密钥,并将其放置在适当的位置。但当我运行应用程序时,它会崩溃而不显示任何内容。这是航海日志

2018-12-19 16:13:00.080 17295-17295/? I/ik7.locationap: Not late-enabling -Xcheck:jni (already on)
2018-12-19 16:13:00.312 17295-17295/? W/ik7.locationap: Unexpected CPU variant for X86 using defaults: x86
2018-12-19 16:13:00.667 17295-17295/com.example.nik7.locationapp W/ik7.locationap: JIT profile information will not be recorded: profile file does not exits.
2018-12-19 16:13:00.669 17295-17295/com.example.nik7.locationapp I/chatty: uid=10087(com.example.nik7.locationapp) identical 10 lines
2018-12-19 16:13:00.670 17295-17295/com.example.nik7.locationapp W/ik7.locationap: JIT profile information will not be recorded: profile file does not exits.
2018-12-19 16:13:00.733 17295-17295/com.example.nik7.locationapp I/InstantRun: starting instant run server: is main process
2018-12-19 16:13:01.001 17295-17295/com.example.nik7.locationapp I/zzbz: Making Creator dynamically
2018-12-19 16:13:01.022 17295-17295/com.example.nik7.locationapp W/ik7.locationap: Unsupported class loader
2018-12-19 16:13:01.023 17295-17295/com.example.nik7.locationapp W/ik7.locationap: Skipping duplicate class check due to unsupported classloader
2018-12-19 16:13:01.033 17295-17295/com.example.nik7.locationapp I/DynamiteModule: Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:221
2018-12-19 16:13:01.033 17295-17295/com.example.nik7.locationapp I/DynamiteModule: Selected remote version of com.google.android.gms.maps_dynamite, version >= 221
2018-12-19 16:13:01.033 17295-17295/com.example.nik7.locationapp V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
2018-12-19 16:13:01.113 17295-17295/com.example.nik7.locationapp W/ik7.locationap: Unsupported class loader
2018-12-19 16:13:01.131 17295-17295/com.example.nik7.locationapp W/ik7.locationap: Skipping duplicate class check due to unsupported classloader
2018-12-19 16:13:01.180 17295-17295/com.example.nik7.locationapp I/Google Maps Android API: Google Play services client version: 12451000
2018-12-19 16:13:01.192 17295-17295/com.example.nik7.locationapp I/Google Maps Android API: Google Play services package version: 14799040
2018-12-19 16:13:01.319 17295-17295/com.example.nik7.locationapp W/ik7.locationap: Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection)
2018-12-19 16:13:01.712 17295-17295/com.example.nik7.locationapp D/OpenGLRenderer: HWUI GL Pipeline
2018-12-19 16:13:01.877 17295-17341/com.example.nik7.locationapp I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2018-12-19 16:13:01.878 17295-17341/com.example.nik7.locationapp I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
2018-12-19 16:13:01.878 17295-17341/com.example.nik7.locationapp I/OpenGLRenderer: Initialized EGL, version 1.4
2018-12-19 16:13:01.878 17295-17341/com.example.nik7.locationapp D/OpenGLRenderer: Swap behavior 1
2018-12-19 16:13:01.883 17295-17341/com.example.nik7.locationapp W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2018-12-19 16:13:01.883 17295-17341/com.example.nik7.locationapp D/OpenGLRenderer: Swap behavior 0
2018-12-19 16:13:01.907 17295-17341/com.example.nik7.locationapp D/EGL_emulation: eglCreateContext: 0xe8310280: maj 2 min 0 rcv 2
2018-12-19 16:13:01.913 17295-17341/com.example.nik7.locationapp D/EGL_emulation: eglMakeCurrent: 0xe8310280: ver 2 0 (tinfo 0xe7093fa0)
2018-12-19 16:13:02.025 17295-17341/com.example.nik7.locationapp D/EGL_emulation: eglMakeCurrent: 0xe8310280: ver 2 0 (tinfo 0xe7093fa0)
2018-12-19 16:13:02.034 17295-17338/com.example.nik7.locationapp D/EGL_emulation: eglCreateContext: 0xe9d05f00: maj 1 min 0 rcv 1
2018-12-19 16:13:02.229 17295-17338/com.example.nik7.locationapp D/EGL_emulation: eglMakeCurrent: 0xe9d05f00: ver 1 0 (tinfo 0xe9d03470)
2018-12-19 16:13:02.564 17295-17319/com.example.nik7.locationapp D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2018-12-19 16:13:03.305 17295-17319/com.example.nik7.locationapp E/AndroidRuntime: FATAL EXCEPTION: Thread-6
    Process: com.example.nik7.locationapp, PID: 17295
    java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
        at ez.b(:com.google.android.gms.dynamite_mapsdynamite@14799084@14.7.99 (100700-223214910):3)
        at ey.a(:com.google.android.gms.dynamite_mapsdynamite@14799084@14.7.99 (100700-223214910):3)
        at fa.a(:com.google.android.gms.dynamite_mapsdynamite@14799084@14.7.99 (100700-223214910):15)
        at com.google.maps.api.android.lib6.drd.al.a(:com.google.android.gms.dynamite_mapsdynamite@14799084@14.7.99 (100700-223214910):6)
        at ed.a(:com.google.android.gms.dynamite_mapsdynamite@14799084@14.7.99 (100700-223214910):21)
        at ed.run(:com.google.android.gms.dynamite_mapsdynamite@14799084@14.7.99 (100700-223214910):8)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/data/user_de/0/com.google.android.gms/app_chimera/m/00000015/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000015/MapsDynamite.apk!/lib/x86, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at ad.loadClass(:com.google.android.gms.dynamite_dynamiteloader@14799084@14.7.99 (100700-223214910):4)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at ez.b(:com.google.android.gms.dynamite_mapsdynamite@14799084@14.7.99 (100700-223214910):3) 
        at ey.a(:com.google.android.gms.dynamite_mapsdynamite@14799084@14.7.99 (100700-223214910):3) 
        at fa.a(:com.google.android.gms.dynamite_mapsdynamite@14799084@14.7.99 (100700-223214910):15) 
        at com.google.maps.api.android.lib6.drd.al.a(:com.google.android.gms.dynamite_mapsdynamite@14799084@14.7.99 (100700-223214910):6) 
        at ed.a(:com.google.android.gms.dynamite_mapsdynamite@14799084@14.7.99 (100700-223214910):21) 
        at ed.run(:com.google.android.gms.dynamite_mapsdynamite@14799084@14.7.99 (100700-223214910):8) 
2018-12-19 16:13:03.338 17295-17295/com.example.nik7.locationapp E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted
2018-12-19 16:13:03.379 17295-17319/com.example.nik7.locationapp I/Process: Sending signal. PID: 17295 SIG: 9
这是compelte日志。我甚至尝试过取消限制,但没有成功。这里有什么问题。我还选择了api 23棉花糖。除了在其位置输入api键之外,我什么也没做

编辑:我也在清单中包含了密钥,但应用程序仍在崩溃

<meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="YOUR_API_KEY"/>

编辑:

似乎是API 28中的一个问题

要修复此问题,请在清单文件的应用程序下添加此代码:

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

这可能是因为你没有安装google play服务。如果你在你的手机上运行这个应用程序,它就可以正常工作了

编辑:

似乎是API 28中的一个问题

要修复此问题,请在清单文件的应用程序下添加此代码:

<uses-library android:name="org.apache.http.legacy" android:required="false"/>


这可能是因为你没有安装google play服务。如果你在你的手机上运行这个应用程序,它就可以正常工作了

要修复它,您可以在清单中的

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

这对我来说很管用

要修复它,您可以在清单中的

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

这对我很有用

因为你没有提供你的代码,我建议你遵循android文档的Map SDK可能重复,因为你没有提供你的代码,我建议你遵循android文档的Map SDK可能重复,我也认为没有安装google play服务。如何安装them@NikhilRathore进入tools SDK manager,选中弹出框右下角的“Show Package Details”,然后在AVD上检查是否安装了google服务。此外,当您打开SDK管理器时,您将在SDK平台页面执行上述操作。点击SDK工具,确保google play服务也被选中。你申请后就不需要了。我只是尝试在最新的API中使用地图视图,它会立即崩溃,除非我在上面的回答中添加了“uses library”代码。我也认为没有安装google play服务。如何安装them@NikhilRathore进入tools SDK manager,选中弹出框右下角的“Show Package Details”,然后在AVD上检查是否安装了google服务。此外,当您打开SDK管理器时,您将在SDK平台页面执行上述操作。点击SDK工具,确保google play服务也被选中。你申请后就不需要了。我只是尝试在最新的API中使用地图视图,它会立即崩溃,除非我在上面的回答中添加“uses library”代码。