Google_maps_flutter仅适用于iOS。我在Android方面有问题

发布于 2025-01-30 06:06:13 字数 7389 浏览 3 评论 0原文

编辑:

我们决定使用OpenStreetMap而不是Google Maps。实际上,我们正在考虑将来返回OpenStreetMap,但我们不想破坏所写的内容。我们做出了这个决定,因为修复程序的成本太高。感谢您的帮助。




”

将添加到项目中的项目以添加额外功能。在添加了在iOS上正常工作的地图后,当涉及到Android时,我会遇到“意外响应代码503,for https://clients4.google.com/glm/mmap/api” 在“调试控制台”部分。完整错误在下面...


  • ​ 项目中
  • 在我

错误

Unexpected response code 503 for https://clients4.google.com/glm/mmap/api 
   
W/MobStoreFlagStore(26335): java.util.concurrent.ExecutionException: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.dotdotdot.dotdot_dotdot, sha256=[de6158b2bcbe47a9e13cccf90dc960571efc28ca09f89e29840e87729f126466], atk=false, ver=221514037.true (go/gsrlt)
    W/MobStoreFlagStore(26335):     at agw.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):3)
    W/MobStoreFlagStore(26335):     at agw.get(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):2)
    W/MobStoreFlagStore(26335):     at aig.g(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):2)
    W/MobStoreFlagStore(26335):     at wy.c(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):1)
    W/MobStoreFlagStore(26335):     at xa.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):0)
    W/MobStoreFlagStore(26335):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
    W/MobStoreFlagStore(26335):     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    W/MobStoreFlagStore(26335):     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    W/MobStoreFlagStore(26335):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    W/MobStoreFlagStore(26335):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    W/MobStoreFlagStore(26335):     at java.lang.Thread.run(Thread.java:923)
    W/MobStoreFlagStore(26335): Caused by: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.bilicisoft.visit_ankara, sha256=[de6158b2bcbe47a9e13cccf90dc960571efc28ca09f89e29840e87729f126466], atk=false, ver=221514037.true (go/gsrlt)
    W/MobStoreFlagStore(26335):     at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
    W/MobStoreFlagStore(26335):     at android.os.Parcel.createException(Parcel.java:2357)
    W/MobStoreFlagStore(26335):     at android.os.Parcel.readException(Parcel.java:2340)
    W/MobStoreFlagStore(26335):     at android.os.Parcel.readException(Parcel.java:2282)

遇到 img src =“ https://i.sstatic.net/mdpqx.png” alt =“错误代码1”>


依赖

environment:
  sdk: ">=2.16.2 <3.0.0"

dependencies:
  mobx: ^2.0.1
  flutter_mobx: ^2.0.0
  mobx_codegen: ^2.0.1+3
  build_runner: ^2.0.6
  easy_localization: ^3.0.0
  shared_preferences: ^2.0.0
  dio: ^4.0.0
  google_maps_flutter: 2.1.5

项Google Maps代码

(我再次提醒您。此代码在Android上对我不起作用,但在iOS上可以。我认为代码没有问题。)

 Container(
                        height: 300,
                        child: googleMap.GoogleMap(
                          mapType: googleMap.MapType.normal,
                          initialCameraPosition: googleMap.CameraPosition(
                            target: googleMap.LatLng(_place?.lat ?? 0, _place?.lng ?? 0),
                            zoom: 15,
                          ),
                          onMapCreated: (googleMap.GoogleMapController controller) {
                            _controller.complete(controller);
                          },
                          markers: Set<googleMap.Marker>.of([
                            googleMap.Marker(
                                markerId: googleMap.MarkerId(_place?.title ?? ""),
                                position: googleMap.LatLng(_place?.lat ?? 0, _place?.lng ?? 0))
                          ]),
                        ),
                      ),

AndroidManifest。 XML

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.dotdot.dot_dot>
    
  <queries>
    <intent>
      <action android:name="android.intent.action.VIEW" />
      <data android:scheme="https" />
    </intent>
    <intent>
      <action android:name="android.intent.action.DIAL" />
      <data android:scheme="tel" />
    </intent>
    <intent>
      <action android:name="android.intent.action.SENDTO" />
      <data android:scheme="smsto" />
    </intent>
  </queries>

   <application
        android:label="APP Name"
        android:icon="@mipmap/ic_launcher"
        android:usesCleartextTraffic="true">

        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
           
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
           
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
         
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
        <meta-data android:name="com.google.android.geo.API_KEY"
            android:value="AIzaSyC_K9N2..........ASD_s4"/>
    </application>
</manifest>

Edit :

We decided to use OpenStreetMap instead of Google Maps. Actually, we were thinking of returning to OpenStreetMap in the future, but we did not want to spoil what was written. We made this decision because the fix would be too costly. Thanks for yours helps.




IOS and Android ScreenShots

The project in use will be added to the project to add extra features. After adding maps that work smoothly on IOS, when it comes to Android, I get the error "Unexpected response code 503 for https://clients4.google.com/glm/mmap/api" in the Debug Console section. The full error is below...


enter image description here

what did i check

  • api key connection
  • Android Emulator (Creating a different project containing Google Maps. It worked with the android emulator without any problem, but the screen does not appear in the project where I got the error.)
  • dependencies update
  • Emulator has google play services

Full Error Code

Unexpected response code 503 for https://clients4.google.com/glm/mmap/api 
   
W/MobStoreFlagStore(26335): java.util.concurrent.ExecutionException: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.dotdotdot.dotdot_dotdot, sha256=[de6158b2bcbe47a9e13cccf90dc960571efc28ca09f89e29840e87729f126466], atk=false, ver=221514037.true (go/gsrlt)
    W/MobStoreFlagStore(26335):     at agw.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):3)
    W/MobStoreFlagStore(26335):     at agw.get(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):2)
    W/MobStoreFlagStore(26335):     at aig.g(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):2)
    W/MobStoreFlagStore(26335):     at wy.c(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):1)
    W/MobStoreFlagStore(26335):     at xa.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):0)
    W/MobStoreFlagStore(26335):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
    W/MobStoreFlagStore(26335):     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    W/MobStoreFlagStore(26335):     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    W/MobStoreFlagStore(26335):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    W/MobStoreFlagStore(26335):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    W/MobStoreFlagStore(26335):     at java.lang.Thread.run(Thread.java:923)
    W/MobStoreFlagStore(26335): Caused by: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.bilicisoft.visit_ankara, sha256=[de6158b2bcbe47a9e13cccf90dc960571efc28ca09f89e29840e87729f126466], atk=false, ver=221514037.true (go/gsrlt)
    W/MobStoreFlagStore(26335):     at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
    W/MobStoreFlagStore(26335):     at android.os.Parcel.createException(Parcel.java:2357)
    W/MobStoreFlagStore(26335):     at android.os.Parcel.readException(Parcel.java:2340)
    W/MobStoreFlagStore(26335):     at android.os.Parcel.readException(Parcel.java:2282)

Error Code ScreenShots

Error Code 1
Error Code 2


Dependencies

environment:
  sdk: ">=2.16.2 <3.0.0"

dependencies:
  mobx: ^2.0.1
  flutter_mobx: ^2.0.0
  mobx_codegen: ^2.0.1+3
  build_runner: ^2.0.6
  easy_localization: ^3.0.0
  shared_preferences: ^2.0.0
  dio: ^4.0.0
  google_maps_flutter: 2.1.5

Google Maps Code

(I remind you again. This code doesn't work for me on Android, but it does on iOS. I don't think there is a problem with the code.)

 Container(
                        height: 300,
                        child: googleMap.GoogleMap(
                          mapType: googleMap.MapType.normal,
                          initialCameraPosition: googleMap.CameraPosition(
                            target: googleMap.LatLng(_place?.lat ?? 0, _place?.lng ?? 0),
                            zoom: 15,
                          ),
                          onMapCreated: (googleMap.GoogleMapController controller) {
                            _controller.complete(controller);
                          },
                          markers: Set<googleMap.Marker>.of([
                            googleMap.Marker(
                                markerId: googleMap.MarkerId(_place?.title ?? ""),
                                position: googleMap.LatLng(_place?.lat ?? 0, _place?.lng ?? 0))
                          ]),
                        ),
                      ),

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.dotdot.dot_dot>
    
  <queries>
    <intent>
      <action android:name="android.intent.action.VIEW" />
      <data android:scheme="https" />
    </intent>
    <intent>
      <action android:name="android.intent.action.DIAL" />
      <data android:scheme="tel" />
    </intent>
    <intent>
      <action android:name="android.intent.action.SENDTO" />
      <data android:scheme="smsto" />
    </intent>
  </queries>

   <application
        android:label="APP Name"
        android:icon="@mipmap/ic_launcher"
        android:usesCleartextTraffic="true">

        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
           
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
           
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
         
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
        <meta-data android:name="com.google.android.geo.API_KEY"
            android:value="AIzaSyC_K9N2..........ASD_s4"/>
    </application>
</manifest>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

菊凝晚露 2025-02-06 06:06:13

在摘要中尝试以上所有内容:

  • SDK在Cloud Console上
  • 添加了秘密键
  • iOS
  • 启用
  • Android
  • 和 然后重新编译。

trying out all the above in Summary:

  • Enabled Android and iOs SDK on Cloud Console
  • Added Secret Key to Android Manifest
  • Adding Map on my App
  • Running the command Flutter clean
  • check all config google map for android
  • Uninstall the app from your device (Phone or Emulator) then compile afresh.
仄言 2025-02-06 06:06:13

以下您的AndroidFestMl文件中缺少的权限退房,

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dotdot.dot_dot>

//add this one
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

 <application
    android:label="APP Name"
    android:icon="@mipmap/ic_launcher"
    android:usesCleartextTraffic="true">

//add this too
<meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

Below permissions missing in your androidfestml file check out,

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dotdot.dot_dot>

//add this one
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

 <application
    android:label="APP Name"
    android:icon="@mipmap/ic_launcher"
    android:usesCleartextTraffic="true">

//add this too
<meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文