HERE map exception “cannot initialize the engine twice”. Android 5.0.1
When I try to initialize MapFragment of HERE map library, an exception occurs. On android 5.0. Android 4.2 works fine.
java.lang.RuntimeException: Cannot initialize the engine twice
at com.nokia.maps.MapsEngine.<init>(MapsEngine.java:585)
at com.nokia.maps.MapsEngine.b(MapsEngine.java:874)
at com.nokia.maps.MapsEngine.b(MapsEngine.java:391)
at com.nokia.maps.MapsEngine.a(MapsEngine.java:343)
at com.here.android.mpa.common.MapEngine.init(MapEngine.java:129)
at com.nokia.maps.br.a(MapFragmentImpl.java:126)
at com.here.android.mpa.mapping.MapFragment.init(MapFragment.java:108)
at com.reverllc.rever.map.MapFragment.setUpMapView(MapFragment.java:366)
at com.reverllc.rever.map.MapFragment.onRideStatusUpdate(MapFragment.java:649)
at com.reverllc.rever.service.TrackingServiceManager.invokeStatusListeners(TrackingServiceManager.java:135)
at com.reverllc.rever.service.TrackingServiceManager.access$600(TrackingServiceManager.java:27)
at com.reverllc.rever.service.TrackingServiceManager$IncomingHandler.handleMessage(TrackingServiceManager.java:276)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
My Map Fragment is located in LinearLayout.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment
class="com.here.android.mpa.mapping.MapFragment"
android:id="@+id/mapfragment"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/relativeLayout"
android:layout_centerHorizontal="true"/>
........................................
On Activity class I get may fragment by id. And I call init method only once. When trying init map an exception occurs. I put breakpoints and I was convinced that init method call only once. I was doing all that is written in the official article HEREmap
Method onCreate in my activity with mapFragment:
@Override
protected void onCreate(Bundle savedInstanceState) {
setUsingEventBus(true);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
mapFragment = (com.here.android.mpa.mapping.MapFragment)getFragmentManager().findFragmentById(
R.id.mapfragment);
mapFragment.init(new OnEngineInitListener() {
@Override
public void onEngineInitializationCompleted(
OnEngineInitListener.Error error)
{
if (error == OnEngineInitListener.Error.NONE) {
map = mapFragment.getMap();
map.setCenter(new GeoCoordinate(49.196261, -123.004773, 0.0),
com.here.android.mpa.mapping.Map.Animation.NONE);
map.setZoomLevel(
(map.getMaxZoomLevel() + map.getMinZoomLevel()) / 2);
} else {
Log.d("MapFragment","ERROR: Cannot initialize Map Fragment");
}
}
});
Can anyone help fix this issue?
UPDATE
application logcat file
android here-api
|
show 2 more comments
When I try to initialize MapFragment of HERE map library, an exception occurs. On android 5.0. Android 4.2 works fine.
java.lang.RuntimeException: Cannot initialize the engine twice
at com.nokia.maps.MapsEngine.<init>(MapsEngine.java:585)
at com.nokia.maps.MapsEngine.b(MapsEngine.java:874)
at com.nokia.maps.MapsEngine.b(MapsEngine.java:391)
at com.nokia.maps.MapsEngine.a(MapsEngine.java:343)
at com.here.android.mpa.common.MapEngine.init(MapEngine.java:129)
at com.nokia.maps.br.a(MapFragmentImpl.java:126)
at com.here.android.mpa.mapping.MapFragment.init(MapFragment.java:108)
at com.reverllc.rever.map.MapFragment.setUpMapView(MapFragment.java:366)
at com.reverllc.rever.map.MapFragment.onRideStatusUpdate(MapFragment.java:649)
at com.reverllc.rever.service.TrackingServiceManager.invokeStatusListeners(TrackingServiceManager.java:135)
at com.reverllc.rever.service.TrackingServiceManager.access$600(TrackingServiceManager.java:27)
at com.reverllc.rever.service.TrackingServiceManager$IncomingHandler.handleMessage(TrackingServiceManager.java:276)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
My Map Fragment is located in LinearLayout.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment
class="com.here.android.mpa.mapping.MapFragment"
android:id="@+id/mapfragment"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/relativeLayout"
android:layout_centerHorizontal="true"/>
........................................
On Activity class I get may fragment by id. And I call init method only once. When trying init map an exception occurs. I put breakpoints and I was convinced that init method call only once. I was doing all that is written in the official article HEREmap
Method onCreate in my activity with mapFragment:
@Override
protected void onCreate(Bundle savedInstanceState) {
setUsingEventBus(true);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
mapFragment = (com.here.android.mpa.mapping.MapFragment)getFragmentManager().findFragmentById(
R.id.mapfragment);
mapFragment.init(new OnEngineInitListener() {
@Override
public void onEngineInitializationCompleted(
OnEngineInitListener.Error error)
{
if (error == OnEngineInitListener.Error.NONE) {
map = mapFragment.getMap();
map.setCenter(new GeoCoordinate(49.196261, -123.004773, 0.0),
com.here.android.mpa.mapping.Map.Animation.NONE);
map.setZoomLevel(
(map.getMaxZoomLevel() + map.getMinZoomLevel()) / 2);
} else {
Log.d("MapFragment","ERROR: Cannot initialize Map Fragment");
}
}
});
Can anyone help fix this issue?
UPDATE
application logcat file
android here-api
The code looks OK, I think there may be another error hidden within adb logcat. Can you try to collect some logs and post it here? The most probable cause is if the native libraries are not packaged in your application.
– David Leong
Nov 14 '16 at 23:18
@David Leong, I added app logcat file. I want to remind that on android 4.2 it works fine
– V. Gerasimenko
Nov 15 '16 at 10:07
Sorry still not enough information. Instead of calling MapFragment.init(), can you please try to use MapsEngine.init() ? The signature should be identical. Does the use of MapEngine.init() return ErrorNone?
– David Leong
Nov 17 '16 at 16:27
@David Leong, when I call MapsEngine.init() , there is the same problem-"Cannot initialize the engine twice"
– V. Gerasimenko
Nov 18 '16 at 12:07
Seems like you have a service as well from your logcat. It is very likely you are trying to init the map engine in both the service and the application side? They must be in the same process?
– David Leong
Nov 20 '16 at 17:32
|
show 2 more comments
When I try to initialize MapFragment of HERE map library, an exception occurs. On android 5.0. Android 4.2 works fine.
java.lang.RuntimeException: Cannot initialize the engine twice
at com.nokia.maps.MapsEngine.<init>(MapsEngine.java:585)
at com.nokia.maps.MapsEngine.b(MapsEngine.java:874)
at com.nokia.maps.MapsEngine.b(MapsEngine.java:391)
at com.nokia.maps.MapsEngine.a(MapsEngine.java:343)
at com.here.android.mpa.common.MapEngine.init(MapEngine.java:129)
at com.nokia.maps.br.a(MapFragmentImpl.java:126)
at com.here.android.mpa.mapping.MapFragment.init(MapFragment.java:108)
at com.reverllc.rever.map.MapFragment.setUpMapView(MapFragment.java:366)
at com.reverllc.rever.map.MapFragment.onRideStatusUpdate(MapFragment.java:649)
at com.reverllc.rever.service.TrackingServiceManager.invokeStatusListeners(TrackingServiceManager.java:135)
at com.reverllc.rever.service.TrackingServiceManager.access$600(TrackingServiceManager.java:27)
at com.reverllc.rever.service.TrackingServiceManager$IncomingHandler.handleMessage(TrackingServiceManager.java:276)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
My Map Fragment is located in LinearLayout.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment
class="com.here.android.mpa.mapping.MapFragment"
android:id="@+id/mapfragment"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/relativeLayout"
android:layout_centerHorizontal="true"/>
........................................
On Activity class I get may fragment by id. And I call init method only once. When trying init map an exception occurs. I put breakpoints and I was convinced that init method call only once. I was doing all that is written in the official article HEREmap
Method onCreate in my activity with mapFragment:
@Override
protected void onCreate(Bundle savedInstanceState) {
setUsingEventBus(true);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
mapFragment = (com.here.android.mpa.mapping.MapFragment)getFragmentManager().findFragmentById(
R.id.mapfragment);
mapFragment.init(new OnEngineInitListener() {
@Override
public void onEngineInitializationCompleted(
OnEngineInitListener.Error error)
{
if (error == OnEngineInitListener.Error.NONE) {
map = mapFragment.getMap();
map.setCenter(new GeoCoordinate(49.196261, -123.004773, 0.0),
com.here.android.mpa.mapping.Map.Animation.NONE);
map.setZoomLevel(
(map.getMaxZoomLevel() + map.getMinZoomLevel()) / 2);
} else {
Log.d("MapFragment","ERROR: Cannot initialize Map Fragment");
}
}
});
Can anyone help fix this issue?
UPDATE
application logcat file
android here-api
When I try to initialize MapFragment of HERE map library, an exception occurs. On android 5.0. Android 4.2 works fine.
java.lang.RuntimeException: Cannot initialize the engine twice
at com.nokia.maps.MapsEngine.<init>(MapsEngine.java:585)
at com.nokia.maps.MapsEngine.b(MapsEngine.java:874)
at com.nokia.maps.MapsEngine.b(MapsEngine.java:391)
at com.nokia.maps.MapsEngine.a(MapsEngine.java:343)
at com.here.android.mpa.common.MapEngine.init(MapEngine.java:129)
at com.nokia.maps.br.a(MapFragmentImpl.java:126)
at com.here.android.mpa.mapping.MapFragment.init(MapFragment.java:108)
at com.reverllc.rever.map.MapFragment.setUpMapView(MapFragment.java:366)
at com.reverllc.rever.map.MapFragment.onRideStatusUpdate(MapFragment.java:649)
at com.reverllc.rever.service.TrackingServiceManager.invokeStatusListeners(TrackingServiceManager.java:135)
at com.reverllc.rever.service.TrackingServiceManager.access$600(TrackingServiceManager.java:27)
at com.reverllc.rever.service.TrackingServiceManager$IncomingHandler.handleMessage(TrackingServiceManager.java:276)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
My Map Fragment is located in LinearLayout.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment
class="com.here.android.mpa.mapping.MapFragment"
android:id="@+id/mapfragment"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/relativeLayout"
android:layout_centerHorizontal="true"/>
........................................
On Activity class I get may fragment by id. And I call init method only once. When trying init map an exception occurs. I put breakpoints and I was convinced that init method call only once. I was doing all that is written in the official article HEREmap
Method onCreate in my activity with mapFragment:
@Override
protected void onCreate(Bundle savedInstanceState) {
setUsingEventBus(true);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
mapFragment = (com.here.android.mpa.mapping.MapFragment)getFragmentManager().findFragmentById(
R.id.mapfragment);
mapFragment.init(new OnEngineInitListener() {
@Override
public void onEngineInitializationCompleted(
OnEngineInitListener.Error error)
{
if (error == OnEngineInitListener.Error.NONE) {
map = mapFragment.getMap();
map.setCenter(new GeoCoordinate(49.196261, -123.004773, 0.0),
com.here.android.mpa.mapping.Map.Animation.NONE);
map.setZoomLevel(
(map.getMaxZoomLevel() + map.getMinZoomLevel()) / 2);
} else {
Log.d("MapFragment","ERROR: Cannot initialize Map Fragment");
}
}
});
Can anyone help fix this issue?
UPDATE
application logcat file
android here-api
android here-api
edited Nov 15 '16 at 10:02
V. Gerasimenko
asked Nov 12 '16 at 8:10
V. GerasimenkoV. Gerasimenko
919
919
The code looks OK, I think there may be another error hidden within adb logcat. Can you try to collect some logs and post it here? The most probable cause is if the native libraries are not packaged in your application.
– David Leong
Nov 14 '16 at 23:18
@David Leong, I added app logcat file. I want to remind that on android 4.2 it works fine
– V. Gerasimenko
Nov 15 '16 at 10:07
Sorry still not enough information. Instead of calling MapFragment.init(), can you please try to use MapsEngine.init() ? The signature should be identical. Does the use of MapEngine.init() return ErrorNone?
– David Leong
Nov 17 '16 at 16:27
@David Leong, when I call MapsEngine.init() , there is the same problem-"Cannot initialize the engine twice"
– V. Gerasimenko
Nov 18 '16 at 12:07
Seems like you have a service as well from your logcat. It is very likely you are trying to init the map engine in both the service and the application side? They must be in the same process?
– David Leong
Nov 20 '16 at 17:32
|
show 2 more comments
The code looks OK, I think there may be another error hidden within adb logcat. Can you try to collect some logs and post it here? The most probable cause is if the native libraries are not packaged in your application.
– David Leong
Nov 14 '16 at 23:18
@David Leong, I added app logcat file. I want to remind that on android 4.2 it works fine
– V. Gerasimenko
Nov 15 '16 at 10:07
Sorry still not enough information. Instead of calling MapFragment.init(), can you please try to use MapsEngine.init() ? The signature should be identical. Does the use of MapEngine.init() return ErrorNone?
– David Leong
Nov 17 '16 at 16:27
@David Leong, when I call MapsEngine.init() , there is the same problem-"Cannot initialize the engine twice"
– V. Gerasimenko
Nov 18 '16 at 12:07
Seems like you have a service as well from your logcat. It is very likely you are trying to init the map engine in both the service and the application side? They must be in the same process?
– David Leong
Nov 20 '16 at 17:32
The code looks OK, I think there may be another error hidden within adb logcat. Can you try to collect some logs and post it here? The most probable cause is if the native libraries are not packaged in your application.
– David Leong
Nov 14 '16 at 23:18
The code looks OK, I think there may be another error hidden within adb logcat. Can you try to collect some logs and post it here? The most probable cause is if the native libraries are not packaged in your application.
– David Leong
Nov 14 '16 at 23:18
@David Leong, I added app logcat file. I want to remind that on android 4.2 it works fine
– V. Gerasimenko
Nov 15 '16 at 10:07
@David Leong, I added app logcat file. I want to remind that on android 4.2 it works fine
– V. Gerasimenko
Nov 15 '16 at 10:07
Sorry still not enough information. Instead of calling MapFragment.init(), can you please try to use MapsEngine.init() ? The signature should be identical. Does the use of MapEngine.init() return ErrorNone?
– David Leong
Nov 17 '16 at 16:27
Sorry still not enough information. Instead of calling MapFragment.init(), can you please try to use MapsEngine.init() ? The signature should be identical. Does the use of MapEngine.init() return ErrorNone?
– David Leong
Nov 17 '16 at 16:27
@David Leong, when I call MapsEngine.init() , there is the same problem-"Cannot initialize the engine twice"
– V. Gerasimenko
Nov 18 '16 at 12:07
@David Leong, when I call MapsEngine.init() , there is the same problem-"Cannot initialize the engine twice"
– V. Gerasimenko
Nov 18 '16 at 12:07
Seems like you have a service as well from your logcat. It is very likely you are trying to init the map engine in both the service and the application side? They must be in the same process?
– David Leong
Nov 20 '16 at 17:32
Seems like you have a service as well from your logcat. It is very likely you are trying to init the map engine in both the service and the application side? They must be in the same process?
– David Leong
Nov 20 '16 at 17:32
|
show 2 more comments
2 Answers
2
active
oldest
votes
I have some problems!!
I found a similar log.
I/Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread.
My solution is that only do mapFragment.init() in onCreate(). Other events are moved to onStart().
That is generally OK, just means the device os a bit slow.
– David Leong
Nov 23 '16 at 2:08
add a comment |
In marshmallow you need to add 4 permission and your map will working fine
ACCESS_NETWORK_STATE);
int FourthPermission = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_WIFI_STATE);
int SecondPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);
int ThirdPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
Use this link for multiple permission
Request Check Multiple Run time Permissions at once in android Marshmallow
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f40560884%2fhere-map-exception-cannot-initialize-the-engine-twice-android-5-0-1%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have some problems!!
I found a similar log.
I/Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread.
My solution is that only do mapFragment.init() in onCreate(). Other events are moved to onStart().
That is generally OK, just means the device os a bit slow.
– David Leong
Nov 23 '16 at 2:08
add a comment |
I have some problems!!
I found a similar log.
I/Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread.
My solution is that only do mapFragment.init() in onCreate(). Other events are moved to onStart().
That is generally OK, just means the device os a bit slow.
– David Leong
Nov 23 '16 at 2:08
add a comment |
I have some problems!!
I found a similar log.
I/Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread.
My solution is that only do mapFragment.init() in onCreate(). Other events are moved to onStart().
I have some problems!!
I found a similar log.
I/Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread.
My solution is that only do mapFragment.init() in onCreate(). Other events are moved to onStart().
answered Nov 21 '16 at 3:51
Ian ChangIan Chang
1
1
That is generally OK, just means the device os a bit slow.
– David Leong
Nov 23 '16 at 2:08
add a comment |
That is generally OK, just means the device os a bit slow.
– David Leong
Nov 23 '16 at 2:08
That is generally OK, just means the device os a bit slow.
– David Leong
Nov 23 '16 at 2:08
That is generally OK, just means the device os a bit slow.
– David Leong
Nov 23 '16 at 2:08
add a comment |
In marshmallow you need to add 4 permission and your map will working fine
ACCESS_NETWORK_STATE);
int FourthPermission = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_WIFI_STATE);
int SecondPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);
int ThirdPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
Use this link for multiple permission
Request Check Multiple Run time Permissions at once in android Marshmallow
add a comment |
In marshmallow you need to add 4 permission and your map will working fine
ACCESS_NETWORK_STATE);
int FourthPermission = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_WIFI_STATE);
int SecondPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);
int ThirdPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
Use this link for multiple permission
Request Check Multiple Run time Permissions at once in android Marshmallow
add a comment |
In marshmallow you need to add 4 permission and your map will working fine
ACCESS_NETWORK_STATE);
int FourthPermission = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_WIFI_STATE);
int SecondPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);
int ThirdPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
Use this link for multiple permission
Request Check Multiple Run time Permissions at once in android Marshmallow
In marshmallow you need to add 4 permission and your map will working fine
ACCESS_NETWORK_STATE);
int FourthPermission = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_WIFI_STATE);
int SecondPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);
int ThirdPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);
Use this link for multiple permission
Request Check Multiple Run time Permissions at once in android Marshmallow
answered Mar 14 '17 at 6:50
kushalkushal
718
718
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f40560884%2fhere-map-exception-cannot-initialize-the-engine-twice-android-5-0-1%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The code looks OK, I think there may be another error hidden within adb logcat. Can you try to collect some logs and post it here? The most probable cause is if the native libraries are not packaged in your application.
– David Leong
Nov 14 '16 at 23:18
@David Leong, I added app logcat file. I want to remind that on android 4.2 it works fine
– V. Gerasimenko
Nov 15 '16 at 10:07
Sorry still not enough information. Instead of calling MapFragment.init(), can you please try to use MapsEngine.init() ? The signature should be identical. Does the use of MapEngine.init() return ErrorNone?
– David Leong
Nov 17 '16 at 16:27
@David Leong, when I call MapsEngine.init() , there is the same problem-"Cannot initialize the engine twice"
– V. Gerasimenko
Nov 18 '16 at 12:07
Seems like you have a service as well from your logcat. It is very likely you are trying to init the map engine in both the service and the application side? They must be in the same process?
– David Leong
Nov 20 '16 at 17:32