How to test fingerprint on emulator in ui tests - android

In ui test I run:
InstrumentationRegistry
.getInstrumentation()
.uiAutomation
.executeShellCommand("-e emu finger touch 45146572")//or"adb -e emu finger touch 45146572"
and then I have got exception:
*** FATAL EXCEPTION IN SYSTEM PROCESS: Thread-10
java.lang.RuntimeException: Error running shell command
at android.app.UiAutomationConnection$1.run(UiAutomationConnection.java:295)
Caused by: java.io.IOException: Error running exec(). Command: [-e, emu, finger, touch, 45146572] Working Directory: null Environment: null
at java.lang.ProcessManager.exec(ProcessManager.java:211)
at java.lang.Runtime.exec(Runtime.java:174)
at java.lang.Runtime.exec(Runtime.java:247)
at java.lang.Runtime.exec(Runtime.java:190)
at android.app.UiAutomationConnection$1.run(UiAutomationConnection.java:281)
Caused by: java.io.IOException: No such file or directory
at java.lang.ProcessManager.exec(Native Method)
at java.lang.ProcessManager.exec(ProcessManager.java:209)
at java.lang.Runtime.exec(Runtime.java:174) 
at java.lang.Runtime.exec(Runtime.java:247) 
at java.lang.Runtime.exec(Runtime.java:190) 
at android.app.UiAutomationConnection$1.run(UiAutomationConnection.java:281) 
Do you have any idea how to fix that?

Related

Release app crash FATAL EXCEPTION: create_react_context (React Native)

I can build in debug mode, it works fine, but when I get release build, it gets build, but the application breaks, you can see the error output here.
FATAL EXCEPTION: create_react_context
java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
FATAL EXCEPTION: create_react_context
Process: com.example, PID: 27990
java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(Unknown Source:2)
at com.facebook.react.bridge.JSBundleLoader$1.loadScript(Unknown Source:10)
at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(Unknown Source:18)
at com.facebook.react.q.q(Unknown Source:180)
at com.facebook.react.q.b(Unknown Source:0)
at com.facebook.react.q$e.run(Unknown Source:68)
at java.lang.Thread.run(Thread.java:764)
"react-native": "0.62.2"
This is a 0.62.2 version issue that was solved here.
Long story short,
Edit ../../node_modules/react-native/react.gradle with this fix

No tests were found on Android Virtual Device Emulator API 30 (UI tests)

I updated Android Studio till 4.1.1, i updated everything for launching emulator AVD on API 30,
but i get "No tests were found" when i'm trying to launch my UI-tests (Espresso framework) on that emulator.
In the same time i have no any problems with emulator 29 or below.
--------- beginning of crash
2020-11-24 18:04:31.036 24852-24852 E/AndroidRuntime: FATAL EXCEPTION: main
PID: 24852
java.lang.IllegalArgumentException: Wrong number of arguments; expected 6, got 3
at java.lang.reflect.Method.invoke(Native Method)
at androidx.test.services.speakeasy.client.ToolConnection$ToolConnectionPostIcs.doCall(ToolConnection.java:197)
at androidx.test.services.speakeasy.client.ToolConnection.publish(ToolConnection.java:79)
at androidx.test.services.speakeasy.client.ToolConnection.publish(ToolConnection.java:69)
at androidx.test.services.shellexecutor.BlockingPublish.getResult(BlockingPublish.java:74)
at androidx.test.services.shellexecutor.ShellCommandExecutorServer.start(ShellCommandExecutorServer.java:80)
at androidx.test.services.shellexecutor.ShellMain.main(ShellMain.java:45)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
2020-11-24 18:04:31.036 24852-24852 E/AndroidRuntime: Error reporting crash
java.lang.RuntimeException: Bad file descriptor
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(BinderProxy.java:540)
at android.app.IActivityManager$Stub$Proxy.handleApplicationCrash(IActivityManager.java:5182)
at com.android.internal.os.RuntimeInit$KillApplicationHandler.uncaughtException(RuntimeInit.java:158)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1073)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
at java.lang.Thread.dispatchUncaughtException(Thread.java:2203)
2020-11-24 18:04:31.036 24852-24852 I/Process: Sending signal. PID: 24852 SIG: 9
Does anybody know what's the problem?
Thank a lot!
You should add permission WAKE_LOCK and increase androidx test orchestrator version. Also you should check actual versions for espresso core, rules and test runner.

React native App is getting crashed. Logcat logs are as described below-

2020-11-13 16:35:41.850 27509-27525/? E/AndroidRuntime: FATAL EXCEPTION: create_react_context
Process: com.sehat, PID: 27509
java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'app.bundle' is packaged correctly for release.
at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:235)
at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:29)
at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:259)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1243)
at com.facebook.react.ReactInstanceManager.access$1000(ReactInstanceManager.java:132)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:996)
at java.lang.Thread.run(Thread.java:764)

I wrote an apk but it shows me unfortunately stopped working

What I see in "Run" footer. It's just a simple UI design and gets installed successfully,
but when I try to open it, it crashes and says " unfortunately stopped working".
I'm kind of new to Android Studio.
also signed the apk but no differences.
02/23 17:05:26: Launching app
$ adb push C:\Users\The King Gh0$T\AndroidStudioProjects\MOCBioPrinter\app\build\outputs\apk\debug\app-debug.apk /data/local/tmp/mking.mocbioprinter
$ adb shell pm install -t -r "/data/local/tmp/mking.mocbioprinter"
pkg: /data/local/tmp/mking.mocbioprinter
Success
APK installed in 3 s 878 ms
$ adb shell am start -n "mking.mocbioprinter/mking.mocbioprinter.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 8148 on device samsung-sm_t561-3801b1493e30a200
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
D/dalvikvm: Late-enabling CheckJNI
D/dalvikvm: Debugger has detached; object registry had 1 entries
D/ActivityThread: handleBindApplication:mking.mocbioprinter
W/dalvikvm: Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lmking/mocbioprinter/MainActivity;
Class init failed in newInstance call (Lmking/mocbioprinter/MainActivity;)
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x4171dbc0)
E/AndroidRuntime: FATAL EXCEPTION: main
Process: mking.mocbioprinter, PID: 8148
java.lang.UnsatisfiedLinkError: Couldn't load native-lib from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/mking.mocbioprinter-7.apk"],nativeLibraryDirectories=[/data/app-lib/mking.mocbioprinter-7, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at mking.mocbioprinter.MainActivity.<clinit>(MainActivity.java:29)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2288)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2493)
at android.app.ActivityThread.access$800(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5590)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
I/Process: Sending signal. PID: 8148 SIG: 9
Application terminated.

Can't debugging JUnit + Roboloctric test in Android Studino with gradle

Yesterday it work fine!
But today i can't run with debug junit test. I don't understand what happens.
Logcat:
17:25:43.540 [ERROR] [system.err] ERROR: transport error 202: connect failed: Connection refused
17:25:43.540 [QUIET] [system.out] FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
17:25:43.540 [ERROR] [system.err] ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
17:25:43.541 [ERROR] [system.err] JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:741]
17:25:43.927 [ERROR] [org.gradle.process.internal.streams.ExecOutputHandleRunner] Could not write standard input into: Gradle Test Executor 2.
java.io.IOException: Broken pipe
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:318)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:50)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
UPD
In this question "Broken pipe error when running Gradle test" was a problem in antivirus. But I dont have it.
Did you have any connectivity issues?
ERROR: transport error 202: connect failed: Connection refused
I had similar problem when executing my tests through proxy.

Categories

Resources