我目前正在使用谷歌地图api开发一个Android应用程序,我有时会因为没有明显的原因而得到一个奇怪的崩溃(在我看来)。这是崩溃日志:
12-02 16:38:57.071 20796-21137/com.appsolute.ParkYoo E/AndroidRuntime﹕ FATAL EXCEPTION: GLThread 4623
Process: com.appsolute.ParkYoo, PID: 20796
java.lang.NullPointerException: Attempt to get length of null array
at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:399)
at java.nio.ByteBufferAsShortBuffer.put(ByteBufferAsShortBuffer.java:159)
at com.google.maps.api.android.lib6.gmm6.o.c.a.d.d(Unknown Source)
at com.google.maps.api.android.lib6.gmm6.o.c.a.d.a(Unknown Source)
at com.google.maps.api.android.lib6.gmm6.o.a.a(Unknown Source)
at com.google.maps.api.android.lib6.gmm6.o.c.b(Unknown Source)
at com.google.maps.api.android.lib6.gmm6.o.c.a(Unknown Source)
at com.google.maps.api.android.lib6.gmm6.o.l.a(Unknown Source)
at com.google.maps.api.android.lib6.gmm6.o.l.b(Unknown Source)
at com.google.maps.api.android.lib6.gmm6.o.cw.k(Unknown Source)
at com.google.maps.api.android.lib6.gmm6.o.cw.run(Unknown Source)
正如你所看到的,崩溃发生在谷歌api但代码已被混淆,所以我没有更多的信息,除了在第2行:
final void put(short[] src, int srcOffset, int shortCount) {
checkIsAccessible();
int byteCount = checkPutBounds(SizeOf.SHORT, src.length, srcOffset, shortCount); // here is the error
this.block.pokeShortArray(offset + position, src, srcOffset, shortCount, order.needsSwap);
position += byteCount;
}
@Override
public ShortBuffer put(short[] src, int srcOffset, int shortCount) {
byteBuffer.limit(limit * SizeOf.SHORT);
byteBuffer.position(position * SizeOf.SHORT);
if (byteBuffer instanceof DirectByteBuffer) {
((DirectByteBuffer) byteBuffer).put(src, srcOffset, shortCount);
} else {
((ByteArrayBuffer) byteBuffer).put(src, srcOffset, shortCount);
}
this.position += shortCount;
return this;
}
有没有人遇到过这个错误?我究竟做错了什么 ?如果有人对此问题有所了解,我很乐意与您讨论。
谢谢!
答案 0 :(得分:11)
您可能正在运行多个地图片段。请参阅我对目前困扰Google地图库的致命错误的撰写,涉及多个地图片段 - 以及我如何找到解决方法。
Google is currently working on the case并优先考虑下一版Google Play服务!