Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get build for APK or over WIFI #141

Open
UmutKavil opened this issue Jan 30, 2025 · 7 comments
Open

Cannot get build for APK or over WIFI #141

UmutKavil opened this issue Jan 30, 2025 · 7 comments

Comments

@UmutKavil
Copy link

i have cloned the project

runs with cable on my local. But when i try to get build APK or access over wifi gives the following error when i click on start route


FATAL EXCEPTION: main
Process: org.maplibre.navigation.android.example, PID: 11092
 java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.maplibre.navigation.android.navigation.v5.models.ManeuverModifier$Type.getText()' on a null object reference
                                                                                                    	at org.maplibre.navigation.android.navigation.ui.v5.map.MapFpsDelegate.validLowFpsManeuver(MapFpsDelegate.java:114)
                                                                                                    	at org.maplibre.navigation.android.navigation.ui.v5.map.MapFpsDelegate.determineMaxFpsFrom(MapFpsDelegate.java:106)
                                                                                                    	at org.maplibre.navigation.android.navigation.ui.v5.map.MapFpsDelegate.adjustFpsFor(MapFpsDelegate.java:85)
                                                                                                    	at org.maplibre.navigation.android.navigation.ui.v5.map.FpsDelegateProgressChangeListener.onProgressChange(FpsDelegateProgressChangeListener.java:18)
                                                                                                    	at org.maplibre.navigation.android.navigation.v5.navigation.NavigationEventDispatcher.onProgressChange(NavigationEventDispatcher.kt:123)
                                                                                                    	at org.maplibre.navigation.android.navigation.v5.navigation.RouteProcessorThreadListener.onNewRouteProgress(RouteProcessorThreadListener.kt:18)
                                                                                                    	at org.maplibre.navigation.android.navigation.v5.navigation.RouteProcessorHandlerCallback.sendUpdateToListener$lambda$1(RouteProcessorHandlerCallback.kt:102)
                                                                                                    	at org.maplibre.navigation.android.navigation.v5.navigation.RouteProcessorHandlerCallback.$r8$lambda$gnfj4WsRHgV30HkTCLurzr4-KBU(Unknown Source:0)
                                                                                                    	at org.maplibre.navigation.android.navigation.v5.navigation.RouteProcessorHandlerCallback$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:230)
                                                                                                    	at android.os.Looper.loop(Looper.java:319)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8919)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
@ozcan-durak
Copy link

i m facing the same error. Anyone knows ?

@UmutKavil
Copy link
Author

anyone able to get build with release *

@Fabi755
Copy link
Collaborator

Fabi755 commented Feb 7, 2025

You can run the Valhalla example without any configuration changes.

For the other samples, you need configure a server.

Do you changed the app/src/main/res/values/developer-config.xml with needed information?

@aurelie-rps
Copy link

I am experiencing the same issue on my phone over Wi-Fi but not when it is connected via USB.

@Fabi755
Copy link
Collaborator

Fabi755 commented Feb 7, 2025

This make no sense to me, as this is an runtime error and has nothing to do with your setup.

As the error says, the ManeuverModifier is NULL. You need to check the response.

@aurelie-rps
Copy link

aurelie-rps commented Feb 7, 2025

I just found out the reason why there is a difference in MapFps.java, validLowFpsManeuver function is not called when the phone is plugged in :

private int determineMaxFpsFrom(RouteProgress routeProgress, Context context) {
    final boolean isPluggedIn = batteryMonitor.isPluggedIn(context);
    RouteLegProgress routeLegProgress = routeProgress.getCurrentLegProgress();

    if (isPluggedIn) {
      return LOW_POWER_MAX_FPS;
    } else if (validLowFpsManeuver(routeLegProgress) || validLowFpsDuration(routeLegProgress)) {
      return maxFpsThreshold;
    } else {
      return LOW_POWER_MAX_FPS;
    }
  } 

@ozcan-durak
Copy link

Temporary Fix Solution:

Replace the :

private boolean validLowFpsManeuver(RouteLegProgress routeLegProgress) {
    final String maneuverModifier = routeLegProgress.getCurrentStep().getManeuver().getModifier().getText();
    return maneuverModifier != null
      && (maneuverModifier.equals(NavigationConstants.STEP_MANEUVER_MODIFIER_STRAIGHT)
      || maneuverModifier.equals(NavigationConstants.STEP_MANEUVER_MODIFIER_SLIGHT_LEFT)
      || maneuverModifier.equals(NavigationConstants.STEP_MANEUVER_MODIFIER_SLIGHT_RIGHT));
  }

With :

private boolean validLowFpsManeuver(RouteLegProgress routeLegProgress) {
    if (routeLegProgress == null) {
      return false;
    }

    if (routeLegProgress.getCurrentStep() == null) {
      return false;
    }

    if (routeLegProgress.getCurrentStep().getManeuver() == null) {
      return false;
    }

    if (routeLegProgress.getCurrentStep().getManeuver().getModifier() == null) {
      return false;
    }

    final String maneuverModifier = routeLegProgress.getCurrentStep().getManeuver().getModifier().getText();
    if (maneuverModifier == null) {
      return false;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants