A
A
Arioch2019-08-16 05:15:55
Android
Arioch, 2019-08-16 05:15:55

How and how to debug apk for Android in Cordova?

Greetings. The situation is this:
- The application (on Vue) builds normally (without error messages) in Cordova, but when you try to run it in the Android Studio emulator, it just shows a white window and that's it.
- At the same time, the same application is normally assembled in Cordova and works for the browser platform.
- Other Android apps build and run fine in the same emulator too.
- That is, both the code is working and the build environment is also working, but something is not glued between them.
How can this be debugged at all? What are the tools for this? I'm just new to Android.
What exactly do I need to do to find the problem? Thank you.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Victor, 2019-08-16
@arioch77

https://www.youtube.com/watch?v=s4zpL4VBbuU Search this for "chrome usb remote debugging"

A
Astrohas, 2018-01-13
@Astrohas

Change the condition to

if not b and ( c=='mod' or c=='/' or c=='div'):
    print("Делеение на ноль")

or better for
if not b and c in ['/','%', 'mod', 'div']:
    print("Делеение на ноль")

and a couple of other options
a = float(input())
b = float(input())
c = input()
z_div = 'Деление на ноль!"
OPERATORS = {
    "+": a + b,
    "-": a - b,
    "*": a * b,
    "/": a / b if b else z_div,
    "mod": a % b if b else z_div,
    "div": a // b if b else z_div,
    "pow": a ** b 
}
print(OPERATORS[c])

a more understandable option, but you have to calculate all the options.
More python way :
a = float(input())
b = float(input())
c = input()
z_div = 'Деление на ноль!'
OPERATORS = {
    "+": lambda x, y: x + y,
    "-": lambda x, y: x - y,
    "*": lambda x, y: x * y,
    "/": lambda x, y: x / y if y else None,
    "mod": lambda x, y: x % y if y else None,
    "div": lambda x, y: x // y if y else None,
    "pow": lambda x, y: x ** y 
}
print(OPERATORS[c](a, b))

ANALOGUE with eval :
a =  input()
b =  input()
c = input()

OPERATORS = {
    "+": "+",
    "-": "-",
    "*": "*",
    "/": "/",
    "mod": "%",
    "div": "//",
    "pow": "**"
}

if not float(b) and c in ['/','%', 'mod', 'div']:
    print('Деление на ноль!')
else:
    print(
        eval(
            a + OPERATORS[c] + b
        )
    )

I
IScream17, 2019-09-11
@IScream17

Specifically, in your code, the condition for checking division by 0 is incorrect:
if (b==0.0) and ((c=='mod') or (c=='/') or (c=='div')):
check is whether the second operand is zero, and whether the function is ONE OF THE division functions (and not all at once).
Z.Y. hello to everyone who came here from the stepik)))

A
Alexey Bely, 2020-10-09
@whitest

I'll leave the info here for the same sufferers like me:
1) In this task, you do not need to define all these mod, div, pow as variables in which the calculation is already performed through other variables.
Like this, DO NOT:

mod = (a) % (b)
pow = (a) ** (b)
div = (a) // (b)

2) It is better to do the whole task through one thick if...elif...else
3) It is not necessary to assign processing b == 0 at the very beginning of the script, operations like 5 + 0 are completely correct and cannot be cut off in this way.
4) The easiest way to process division by zero is to do it sequentially, through the same eilf:
elif (b == 0) and f == 'div':
    print('Деление на 0!')
elif f == 'div':
    print(a // b)

5) The solution through OPERATORS works, but! If you don't know how to write it yourself out of your head, don't use it. Then it will get worse.
a = float(input())
b = float(input())
c = input()
z_div = 'Деление на ноль!'
OPERATORS = {
    "+": a + b,
    "-": a - b,
    "*": a * b,
    "/": a / b if b else z_div,
    "mod": a % b if b else z_div,
    "div": a // b if b else z_div,
    "pow": a ** b
}
print(OPERATORS[c])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question