Closed KerryKilian closed 3 years ago
The handler is the interface you implement yourself.
Is it the class or the map or something else? Maybe you can give an example?
For example
int nodes = 0;
int ways = 0;
int relations = 0;
overpassMapDataDao.queryElements("[bbox:13.8,35.5,14.9,36.3]; nwr[shop]; out meta;", new MapDataHandler() {
public void handle(BoundingBox bounds) {
// a bounding box was parsed from the overpass response, do something with it or not
}
public void handle(Node node) {
// a node was parsed from the overpass response, do something with it or not
nodes++;
}
public void handle(Way way) {
// a way was parsed from the overpass response, do something with it or not
ways++;
}
public void handle(Relation relation) {
// a relation was parsed from the overpass response, do something with it or not
relations++;
}
});
System.out.println("On Malta, there are " (nodes+ways+relations) + " shops, of these: " + nodes + " nodes, " + ways + " ways and " + relations + " relations");
I get this error (and much more lines similar to that): Duplicate class org.jetbrains.annotations.Async$Execute found in modules jetified-annotations-16.0.1 (org.jetbrains:annotations:16.0.1) and jetified-annotations-java5-18.0 (org.jetbrains:annotations-java5:18.0.0)
Thanks by the way for your help:)
Hm I don't remember what was the solution to it. The annotations used in this library collide with the annotations used in Android. In the gradle config, you can exclude certain dependencies to remove the duplicates. I am too busy so I can't help you now, try searching for the problem with google. When you found the solution, please let me know, then I can update the readme.
In build.gradle under android { } I added configurations { cleanedAnnotations compile.exclude group: 'org.jetbrains' , module:'annotations' all*.exclude group: 'xmlpull', module: 'xmlpull' }
The error disappears and my app is starting but crashes right after start. Now I have to figure out if these above lines caused the crash or something else in my code
EDIT: Your example code from above causes the crash
Android studio does not know the "handler". How can I initilize it?