I'm using latest android studio, usb debugging enabled, phone recognized by AS and code sucesfully compiled and run on simulator, however when I actaully trying to run app, it's fails with this error:
$ adb shell am start -n "com.example.ph.myapplication/com.example.ph.myapplication.OnlyTetstBBBAct" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.example.ph.myapplication/com.example.ph.myapplication.OnlyTetstBBBAct" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.ph.myapplication/.OnlyTetstBBBAct }
Error type 3
Error: Activity class {com.example.ph.myapplication/com.example.ph.myapplication.OnlyTetstBBBAct} does not exist.
Error while Launching activity
At the same time I could see something like this in android monitor window (however I'm not sure is it 100% correlated):
01-12 17:50:19.111 18352-18352/? E/appproc: ERROR: could not find class 'com.android.commands.pm.Pm'
01-12 17:50:19.111 18352-18352/? A/art: art/runtime/thread.cc:1143] No pending exception expected: java.lang.ClassNotFoundException: Didn't find class "com.android.commands.pm.Pm" on path: DexPathList[[zip file "/system/framework/pm.jar"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
01-12 17:50:19.111 18352-18352/? A/art: art/runtime/thread.cc:1143] at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
01-12 17:50:19.111 18352-18352/? A/art: art/runtime/thread.cc:1143] at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:511)
01-12 17:50:19.111 18352-18352/? A/art: art/runtime/thread.cc:1143] at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:469)
01-12 17:50:19.111 18352-18352/? A/art: art/runtime/thread.cc:1143]
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] Runtime aborting...
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] Aborting thread:
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] "main" prio=5 tid=1 Runnable
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] | group="" sCount=0 dsCount=0 obj=0x12c41100 self=0x55bed629b0
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] | sysTid=18352 nice=0 cgrp=default sched=0/0 handle=0x7fb6243e80
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] | state=R schedstat=( 347813798 1653280 115 ) utm=22 stm=12 core=1 HZ=100
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] | stack=0x7fddc23000-0x7fddc25000 stackSize=8MB
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] | held mutexes= "abort lock" "mutator lock"(shared held)
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] native: #00 pc 000039a4 /system/lib64/libbacktrace_libc++.so (_ZN9Backtrace6UnwindEmP8ucontext+28)
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] native: #01 pc 0000001c ???
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] (no managed stack frames)
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] Pending exception java.lang.ClassNotFoundException thrown by 'unknown throw location'
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] java.lang.ClassNotFoundException: Didn't find class "com.android.commands.pm.Pm" on path: DexPathList[[zip file "/system/framework/pm.jar"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:511)
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:469)
01-12 17:50:19.231 18352-18352/? A/art: art/runtime/runtime.cc:289] Dumping all threads without appropriate locks held: thread list lock
...
This is a very annoying problem for me, I'm trying to resolve it quite a lot of time already, but the only answer I found somewhere was to install different ROM, even not explaining why do that, so I'm looking for a better alternative, and it's important for me to understand why this happen. So I will be super appriciate if you will help me to resolve this issue and/or explain, what's going on there.
Upd1: I could install app on device manually and it's run just fine, I could even debug it with AS, however if I make any change in code and then rerun application, it's still old version of code run on device, untill I manually remove old apk/install new one.