将图像解码为位图失败的原因

时间:2017-10-05 20:43:07

标签: android image google-maps android-bitmap

我正在尝试将地面叠加层放置到谷歌地图上。这是我的代码,用于制作图像的位图并将其放置到地图

BitmapDescriptor bmpD = BitmapDescriptorFactory.fromResource(R.drawable.colored_min);

    GroundOverlayOptions newarkMap = new GroundOverlayOptions()
            .image(bmpD)
            .position(kbtuLatLng, 12000f)//second argument for size
            .bearing(354)//rotate
            .anchor((float) 0.375,(float) 0.5);//position change
    GroundOverlay imageOverlay = mMap.addGroundOverlay(newarkMap);

并且此代码错误导致此错误

 com.google.maps.api.android.lib6.common.apiexception.b: Failed to decode image. The provided image must be a Bitmap.
                                                                           at com.google.maps.api.android.lib6.impl.m.a(:com.google.android.gms.DynamiteModulesB@11517470:12)
                                                                           at com.google.maps.api.android.lib6.impl.n.a(:com.google.android.gms.DynamiteModulesB@11517470:7)
                                                                           at com.google.maps.api.android.lib6.impl.bj.<init>(:com.google.android.gms.DynamiteModulesB@11517470:37)
                                                                           at com.google.maps.api.android.lib6.impl.ba.a(:com.google.android.gms.DynamiteModulesB@11517470:540)
                                                                           at com.google.android.gms.maps.internal.k.onTransact(:com.google.android.gms.DynamiteModulesB@11517470:99)
                                                                           at android.os.Binder.transact(Binder.java:604)
                                                                           at com.google.android.gms.internal.zzed.zza(Unknown Source:7)
                                                                           at com.google.android.gms.maps.internal.zzg.addGroundOverlay(Unknown Source:9)
                                                                           at com.google.android.gms.maps.GoogleMap.addGroundOverlay(Unknown Source:2)
                                                                           at com.example.asset.kbtumap.MainActivity.onMapReady(MainActivity.java:123)
                                                                           at com.google.android.gms.maps.zzaj.zza(Unknown Source:7)
                                                                           at com.google.android.gms.maps.internal.zzaq.onTransact(Unknown Source:18)
                                                                           at android.os.Binder.transact(Binder.java:604)
                                                                           at gl.b(:com.google.android.gms.DynamiteModulesB@11517470:20)
                                                                           at com.google.android.gms.maps.internal.bf.a(:com.google.android.gms.DynamiteModulesB@11517470:5)
                                                                           at com.google.maps.api.android.lib6.impl.bc.run(:com.google.android.gms.DynamiteModulesB@11517470:5)
                                                                           at android.os.Handler.handleCallback(Handler.java:769)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                           at android.os.Looper.loop(Looper.java:164)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:6540)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                           at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

线指针指向GroundOverlay imageOverlay = mMap.addGroundOverlay(newarkMap)

有人可以帮助解决这个问题!!

0 个答案:

没有答案