Android emulator can't run my app

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Tomi

Hello!
I have made my first little app with Godot. This program just move an object towards mouse coordinates. But when I try start it in Leapdroid emulator, it shows me that “Unfortunately myapp has stopped”. What’s wrong with my code? It is only a few lines and hopefully error free:

extends KinematicBody2D

var kovx: int=position.x
var kovy: int=position.y
#var betukeszlet = Control.new().get_font(“font”)

Called every frame. ‘delta’ is the elapsed time since the previous frame.

func _physics_process(delta):
if get_viewport().get_mouse_position().x<position.x:
kovx=position.x-4
elif get_viewport().get_mouse_position().x>position.x:
kovx=position.x+4
else:
kovx=position.x

if get_viewport().get_mouse_position().y<position.y:
	kovy=position.y-4
elif get_viewport().get_mouse_position().y>position.y:
	kovy=position.y+4
else:
	kovy=position.y
	
position.x=kovx
position.y=kovy

#draw_string(betukeszlet, Vector2(4, 4), "JatX: ")

Maybe I configured Android settings badly? But in this case how can it build an .APK?

Now I tried to run my app in Android Studio, but I got the following error message:
“The application could not be installed: INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES”
What is means?

Tomi | 2021-05-05 08:36

:bust_in_silhouette: Reply From: magicalogic

Function get_mouse_position() does not work on Android even in the emulator.
Refer to this to see how to achieve the results you are looking for: https://forum.godotengine.org/28543/godot-3-0-2-get-global-position-from-touchscreen

Hello magicalogic and thank you for your answer! I didn’t know that there are Android specific commands in Godot.
I tried my app without any code, but the situation is the same: Godot can export .APK, but it stopped in Leapdroid. :frowning:

Tomi | 2021-05-05 08:12

Have you tried running it in a real Android device?

magicalogic | 2021-05-05 08:39

No, because I have only an LG K8 smartphone with quite few free space.
But maybe did I a mistake when set things in Android Studio? In Android SDK Settings I choose an obsolete NDK instead of NDK (Side by side). Can this cause the error? Should I reinstall this?

Tomi | 2021-05-05 08:53

Everything is OK now! Just I must check the x86 architecture too when I exporting the APK!

Tomi | 2021-05-06 09:10

These small mistakes are the worst.

magicalogic | 2021-05-06 10:59

Yes, and I found out by accident. But now I’m happy Godot works properly and I can deal with game making. If all is true, this will be my first Android game.

Tomi | 2021-05-07 07:25