HERE map:引起:java.lang.NoSuchMethodError:没有非静态方法“Ljava / lang / AssertionError;。<init>(Ljava / lang / String;)V”

时间:2016-11-21 10:11:07

标签: java android maps here-api

11-21 17:26:54.852 9831-9864/? E/NETWORK: [ERROR] NETWORK - Request: https://places.hybrid.api.here.com/places/v1/meta/offline?app_id=APP_ID&app_code=APP_CODE Error: 400 Bad Request
11-21 17:26:58.097 9831-9915/? E/art: No <init>(Ljava/lang/String;)V in java.lang.Class<java.lang.AssertionError>    
11-21 17:26:58.103 9831-9915/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3                                       
Process: com.zfz.fhl.heremap, PID: 9831                                                 
java.lang.RuntimeException: An error occured while executing doInBackground()                                                     
  at android.os.AsyncTask$3.done(AsyncTask.java:304)                                                
  at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)                                                     
  at java.util.concurrent.FutureTask.setException(FutureTask.java:222)                                                  
  at java.util.concurrent.FutureTask.run(FutureTask.java:242)                                                   
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)    
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)                                                         
  at java.lang.Thread.run(Thread.java:818)

Caused by: java.lang.NoSuchMethodError: no non-static method "Ljava/lang/AssertionError;.<init>(Ljava/lang/String;)V"                                                    
  at com.nokia.maps.PlacesBaseRequest.poll(Native Method)                                              
  at com.nokia.maps.PlacesBaseRequest.e(PlacesBaseRequest.java:62)                                                     
  at com.nokia.maps.PlacesBaseRequest$b.a(PlacesBaseRequest.java:732)                                                     
  at com.nokia.maps.PlacesBaseRequest$b.doInBackground(PlacesBaseRequest.java:713)                                                     
  at android.os.AsyncTask$2.call(AsyncTask.java:292)                                                     
  at java.util.concurrent.FutureTask.run(FutureTask.java:237)                                                     
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)                                                    
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)                                                     
  at java.lang.Thread.run(Thread.java:818) 

这是我的主要代码:

GeoCoordinate geoCoordinate = new GeoCoordinate(49.196261, -123.004773);

 DiscoveryRequest request = new SearchRequest("restaurant").setSearchCenter(geoCoordinate);

                    ErrorCode execute = request.execute(new ResultListener<DiscoveryResultPage>() {

                        @Override
                        public void onCompleted(DiscoveryResultPage discoveryResultPage, ErrorCode errorCode) {
                            if (discoveryResultPage != null) {
                                List<DiscoveryResult> discoveryResultList = discoveryResultPage.getItems();
                                for (DiscoveryResult result :
                                        discoveryResultList) {

                                }
                            }
                        }
                    });

app_id和app_code是正确的,这是一个非常简单的演示,其他代码是加载地图,在添加上面这些代码然后出现这个错误,我认为这个错误是由HERE MAP SDK引起的,如果有的话遇到并可以解决这个问题,请回复下面,谢谢你花时间回答

1 个答案:

答案 0 :(得分:0)

我真的没办法好久,我换了一块android设备,并出现了其他错误: E / dalvikvm:找不到从com.nokia.maps.dz方法引用的类'com.google.gson.GsonBuilder'。 然后我导入了gson包,问题解决了,我觉得这很奇怪,不同的android设备出现了不同的错误,这两个错误都很不一样