java ANDROID:错误 W/DynamiteModule:未找到 com.google.android.gms.googlecertificates 的本地模块描述符类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40561373/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 05:19:21  来源:igfitidea点击:

ANDROID: Error W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found

javaandroidgoogle-maps

提问by Raquel Romero Sanabria

I am trying to do a MapActivity using Android Studio. It has to show the user's location.

我正在尝试使用 Android Studio 执行 MapActivity。它必须显示用户的位置。

Well, I know I need a key in order to use the API, and believe me, I changed that key at least four times… I also have the permissions in the AndroidManifest.xml.

好吧,我知道我需要一个密钥才能使用 API,相信我,我至少更改了四次该密钥......我在 AndroidManifest.xml 中也有权限。

The thing is I can show the map without the user's location, but if I try to show his/her location, then the app compiles well BUT when I try to execute it, it stops and I obtain this error:

问题是我可以在没有用户位置的情况下显示地图,但是如果我尝试显示他/她的位置,那么应用程序可以很好地编译但是当我尝试执行它时,它会停止并出现此错误:

11-12 09:13:28.416 21576-21653/raquel.mapapplication W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
11-12 09:13:28.424 21576-21653/raquel.mapapplication I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:2
11-12 09:13:28.424 21576-21653/raquel.mapapplication I/DynamiteModule: Selected remote version of com.google.android.gms.googlecertificates, version >= 2
11-12 09:13:28.432 21576-21653/raquel.mapapplication W/System: ClassLoader referenced unknown path: /data/user/0/com.google.android.gms/app_chimera/m/0000000b/n/armeabi
11-12 09:13:28.436 21576-21653/raquel.mapapplication D/GoogleCertificates: com.google.android.gms.googlecertificates module is loaded
11-12 09:13:28.504 21576-21653/raquel.mapapplication D/GoogleCertificatesImpl: Fetched 190 Google release certificates
11-12 09:13:28.505 21576-21653/raquel.mapapplication D/GoogleCertificatesImpl: Fetched 363 Google certificates
11-12 09:13:31.235 21576-21576/raquel.mapapplication I/Process: Sending signal. PID: 21576 SIG: 9

It mentions something about Google Certificates, and that is why I thought maybe it has something to do with the key… But I am not sure and I do not have idea what I am doing wrong.

它提到了一些关于谷歌证书的东西,这就是为什么我认为它可能与密钥有关......但我不确定,我不知道我做错了什么。

Thank you for your help.

谢谢您的帮助。

////////

////////

Ok, I will try to post some code... I have been changing the code all the time, but this is the last I tried (I also tried setMyLocationEnable(true), because getMyLocation() is deprecated, but I obtain the same error):

好的,我会尝试发布一些代码...我一直在更改代码,但这是我尝试的最后一次(我也尝试过 setMyLocationEnable(true),因为不推荐使用 getMyLocation(),但我获得了相同的错误):

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

    private GoogleMap mMap;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_maps);
        // 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;

        Location location=mMap.getMyLocation();

        double lat=location.getLatitude();
        double lon=location.getLongitude();

        // Add a marker in Sydney and move the camera
        LatLng sydney = new LatLng(lat, lon);
        mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
        mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
    }
}

Thanks the person who answered me and the person who edited my comment... I still do not well how to format text...

感谢回答我的人和编辑我评论的人......我仍然不知道如何格式化文本......

回答by Pablo Cegarra

Open the sdk manager, download/update google play services. And create a new emulator.

打开sdk manager,下载/更新google play services。并创建一个新的模拟器。

回答by Pablo Cegarra

Loading certificates may be the bug in API and i think somewhere any google developer also have described it that play service is trying to do sign in to verify play app or third party app so that could be error. I do not know more further about it.

加载证书可能是 API 中的错误,我认为在某个地方,任何谷歌开发人员也描述了播放服务正在尝试登录以验证播放应用程序或第三方应用程序,因此这可能是错误的。我不知道更多。

but if you are still having trouble with placing marker on user,s position you can try below code i have tested it and is working in application

但是如果您仍然无法在用户的位置上放置标记,您可以尝试下面的代码,我已经测试过它并且正在应用程序中工作

@Override
public void onMapReady(GoogleMap googleMap)

{
    myGoogleMap = googleMap;
    placeMarkerOnPosition();
}

public void placeMarkerOnPosition() {
//// check permissions to access resources ///////// 
if (ActivityCompat.checkSelfPermission(this, 
android.Manifest.permission.ACCESS_FINE_LOCATION) != 
PackageManager.PERMISSION_GRANTED && 
ActivityCompat.checkSelfPermission(this, 
android.Manifest.permission.ACCESS_COARSE_LOCATION) != 
PackageManager.PERMISSION_GRANTED) {

    return;
}
    LocationManager locationManager = (LocationManager) 
    getSystemService(Context.LOCATION_SERVICE);

Now you can find it with two ways

现在你可以通过两种方式找到它

////////////////  find location if GPS provider is available (GPS should 
enable to envoke this callback)

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, 
new LocationListener() 
{
 @Override
 public void onLocationChanged(Location location) {

try {
    Geocoder geocoder = new Geocoder(getApplicationContext());                              
    myLatitude = location.getLatitude();
    myLongitude = location.getLongitude();
    LatLng myPosition = new LatLng(myLatitude,myLongitude);
    List<Address> places=geocoder.getFromLocation(myLatitude, 
    myLongitude,1);
    myLocation = places.get(0).getSubLocality() 
                 +""+places.get(0).getLocality();

    myGoogleMap.clear();
    myGoogleMap.addMarker(new 
    MarkerOptions().position(myPosition).title(myLocation));

    myGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myPosition, 
                                                                 13.5f));


    } catch (IOException e) {
      e.printStackTrace();
    }
   }

    @Override
    public void onStatusChanged(String s, int i, Bundle bundle) {

    }

    @Override
    public void onProviderEnabled(String s) {

    }

    @Override
    public void onProviderDisabled(String s) {

    }
    });

////////////////   checking with network providers   /////////


if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {


locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 
                                       0, new LocationListener() {
@Override
public void onLocationChanged(Location location) {
myLatitude = location.getLatitude();
myLongitude = location.getLongitude();
LatLng myPosition = new LatLng(myLatitude, myLongitude);
myGoogleMap.clear();
myGoogleMap.addMarker(new MarkerOptions().position(myPosition).title("My 
                                                             Position"));

myGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myPosition, 
                                                              13.5f));

}

}

                @Override
                public void onStatusChanged(String s, int i, Bundle bundle) 
                {

                }

                @Override
                public void onProviderEnabled(String s) {

                }

                @Override
                public void onProviderDisabled(String s) {

                }
            });

        }

   ////////  Or you can find it with user  recent location //////////

   Criteria criteria = new Criteria();
   String bestProvider = locationManager.getBestProvider(criteria,true);
   Locationlocation=locationManager.getLastKnownLocation(bestProvider);

   //////////   load your location from last recent locations ////////
            if (location != null) {
                Geocoder geocoder = new Geocoder(getApplicationContext());

                try {
                    myLatitude = location.getLatitude();
                    myLongitude = location.getLongitude();
                    LatLng myPosition = new LatLng(myLatitude, myLongitude);
                    List<Address> places = 
                    geocoder.getFromLocation(myLatitude, myLongitude, 1);
                    myLocation = places.get(0).getSubLocality() + " " + places.get(0).getLocality();

                    myGoogleMap.clear();
                    myGoogleMap.addMarker(new MarkerOptions().position(myPosition).title(myLocation));
                    myGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myPosition, 13.5f));


                } catch (IOException e) {
                    e.printStackTrace();
                }