报错信息:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.augurit.agmobile.agplant/com.augurit.agmobile.agplant.addpestinfo.AddInfoActivity}: java.lang.IllegalArgumentException: marker's icon can not be null
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2444)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2504)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:682)
Caused by: java.lang.IllegalArgumentException: marker's icon can not be null
at com.baidu.mapapi.map.MarkerOptions.icon(Unknown Source)
at com.augurit.agmobile.agplant.addpestinfo.AddInfoActivity.initViewFromDraft(AddInfoActivity.java:366)
at com.augurit.agmobile.agplant.addpestinfo.AddInfoActivity.onCreate(AddInfoActivity.java:256)
at android.app.Activity.performCreate(Activity.java:6367)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2397)
提示报错代码段位置:366行
报错代码:
错误分析:
Caused by: java.lang.IllegalArgumentException: marker's icon can not be null
代码里面明明写了icon,左边的预览图标都出来了!为什么还是报错?
试用了两种icon:1,png图片;2,矢量图片
当使用矢量图的时候就会出现这个错误,png图片则不会。
解决办法:
使用png,jpg图片试试,避免使用矢量图;