I can’t start the application from Android Studio on Xiaomi Mi 4c (I think the device may be the reason)

I use the latest android studio, the USB disk is debugged, the phone is recognized by AS and a code that is readily compiled and runs on the simulator, however, when I just try to run the application, it does not cope 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 the Android monitor window (however, I'm not sure if it is 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
...

, , , -, - , , , , , . , / , .


Upd1: , , AS, , - , , , apk/install new.

+4
3

, , , . root, adbd insecure, adbd insecure , , .

0

, , $adb shell ... , , , AS ( ).


() , "XXX":

adb shell am start -n "XXXcom.hotveryspicy.maskimage/info.androidhive.slidingmenu.SlidingMenuActivity"

: { CMP = XXXcom.hotveryspicy.maskimage/info.androidhive.slidingmenu.SlidingMenuActivity }

3 :   {XXXcom.hotveryspicy.maskimage/info.androidhive.slidingmenu.SlidingMenuActivity}    .

, , ( ).
100% , ?
AndroidManifest.xml OnlyTetstBBBAct :

    package="com.example.ph.myapplication"
<activity android:name="com.example.ph.myapplication.OnlyTetstBBBAct" >

AndroidManifest.xml, , .
apk:

aapt dump badging <path-to-apk> 

(, C:\Android\sdk\build-tools\25.0.0\aap dump badging app-debug.apk)
:

adb uninstall com.example.ph.myapplication
adb -d install C:\Android\MaskActivity\app\build\outputs\apk\app-debug.apk
adb install -r app-debug.apk //(re-install preserving data)
adb shell rm /data/local/tmp/*.apk
adb devices
adb shell pm list packages

-:

adb logcat


, :

C:\Android\sdk\tools\monitor
+1

Try adding the following code to your build.gradle (app) file

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0"

         defaultConfig {
             minSdkVersion 14 //lower than 14 doesn't support multidex
             targetSdkVersion 22

             // Enabling multidex support.
             multiDexEnabled true
         }
}

dependencies {
    compile 'com.android.support:multidex:1.0.1'
}
0
source

Source: https://habr.com/ru/post/1666616/


All Articles