Android Studio - logcat

2020-01-19 09:34发布

问题:

Can someone tell me what is wrong with my app it crashes on statr . Here is the LogCat:

Process: com.moneyegg.bdpsoft.makemonepaypal, PID: 3358
                                                                                   java.lang.RuntimeException: Unable to start activity ComponentInfo{com.moneyegg.bdpsoft.makemonepaypal/com.moneyegg.bdpsoft.makemonepaypal.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class uses-permission
                                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
                                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
                                                                                       at android.app.ActivityThread.access$800(ActivityThread.java:151)
                                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
                                                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                       at android.os.Looper.loop(Looper.java:135)
                                                                                       at android.app.ActivityThread.main(ActivityThread.java:5254)
                                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                                       at java.lang.reflect.Method.invoke(Method.java:372)
                                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
                                                                                    Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class uses-permission
                                                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:757)
                                                                                       at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
                                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
                                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
                                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
                                                                                       at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
                                                                                       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                                       at com.moneyegg.bdpsoft.makemonepaypal.MainActivity.onCreate(MainActivity.java:32)
                                                                                       at android.app.Activity.performCreate(Activity.java:5990)
                                                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
                                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
                                                                                       at android.app.ActivityThread.access$800(ActivityThread.java:151) 
                                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
                                                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                       at android.os.Looper.loop(Looper.java:135) 
                                                                                       at android.app.ActivityThread.main(ActivityThread.java:5254) 
                                                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                                                       at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
                                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
                                                                                    Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.uses-permission" on path: DexPathList[[zip file "/data/app/com.moneyegg.bdpsoft.makemonepaypal-2/base.apk", zip file "/data/app/com.moneyegg.bdpsoft.makemonepaypal-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.moneyegg.bdpsoft.makemonepaypal-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.moneyegg.bdpsoft.makemonepaypal-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.moneyegg.bdpsoft.makemonepaypal-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.moneyegg.bdpsoft.makemonepaypal-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.moneyegg.bdpsoft.makemonepaypal-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.moneyegg.bdpsoft.makemonepaypal-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.moneyegg.bdpsoft.makemonepaypal-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.moneyegg.bdpsoft.makemonepaypal-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.moneyegg.bdpsoft.makemonepaypal-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.moneyegg.bdpsoft.makemonepaypal-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
                                                                                       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                                       at android.view.LayoutInflater.createView(LayoutInflater.java:571)
                                                                                       at android.view.LayoutInflater.onCreateView(LayoutInflater.java:665)
                                                                                       at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:65)
                                                                                       at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
                                                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
                                                                                       at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
                                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
                                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
                                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
                                                                                       at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
                                                                                       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                                                       at com.moneyegg.bdpsoft.makemonepaypal.MainActivity.onCreate(MainActivity.java:32) 
                                                                                       at android.app.Activity.performCreate(Activity.java:5990) 
                                                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
                                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 
                                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
                                                                                       at android.app.ActivityThread.access$800(ActivityThread.java:151) 
                                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
                                                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                       at android.os.Looper.loop(Looper.java:135) 
                                                                                       at android.app.ActivityThread.main(ActivityThread.java:5254) 
                                                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                                                       at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
                                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
                                                                                    Suppressed: java.lang.ClassNotFoundException: android.view.uses-permission
                                                                                       at java.lang.Class.classForName(Native Method)
                                                                                       at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                                                       at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                                                        at java.lang.ClassLoader.loadClass(ClassLoader
07-29 19:03:38.835 1149-1908/? E/audio_hw_generic: Error opening input stream format 1, channel_mask 0010, sample_rate 16000
07-29 19:03:38.837 1149-1520/? E/cutils-trace: Error opening trace file: Permission denied (13)
07-29 19:04:45.254 1150-1150/? E/installd: eof
07-29 19:04:45.254 1150-1150/? E/installd: failed to read size
01-01 00:00:00.000 0-0/? E/Internal: device 'emulator-5554' not found

回答1:

Check your XML for Main Activity, there is a permission declaration, which should go to AndroidManifest.xml, and not in layout XMLs.