在硬件设备上运行时出现Android Studio错误

时间:2016-11-01 04:07:21

标签: java android android-studio galaxy

我尝试在apk 17中运行默认的“hello world”程序到我的硬件设备上,运行apk 19(KitKat)的SAMSUNG Galaxy s3。我的程序在APK 21模拟器上完美运行,但应用程序在我的设备上加载一瞬间然后崩溃。我确信我得到了正确的驱动程序,因为当我点击“运行”按钮时,我的设备名称显示出来,它可以与我的设备通信。它绝对是USB调试模式,我已经尝试撤销授权并将其返回给我的电脑无济于事。也许我;使用过时版本的gradle或其他东西?

以下是崩溃日志:

10/31 20:43:14: Launching app
$ adb push C:\Users\G\AndroidStudioProjects\HappyBirthday\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.example.android.happybirthday
$ adb shell pm install -r "/data/local/tmp/com.example.android.happybirthday"
    pkg: /data/local/tmp/com.example.android.happybirthday
Success


$ adb shell am start -n "com.example.android.happybirthday/com.example.android.happybirthday.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 30844 on device samsung-sph_l710t-b3849b78
I/InstantRun: Instant Run Runtime started. Android package is com.example.android.happybirthday, real application class is null.
W/InstantRun: No instant run dex files added to classpath
I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts
W/dalvikvm: VFY: unable to resolve interface method 15997: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
W/dalvikvm: VFY: unable to resolve interface method 15999: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
W/dalvikvm: VFY: unable to resolve interface method 16003: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
W/dalvikvm: VFY: unable to resolve virtual method 685: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
W/dalvikvm: VFY: unable to resolve virtual method 707: Landroid/content/res/TypedArray;.getType (I)I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
E/VdcInflateDelegate: Exception while inflating <vector>
                      org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportHeight > 0
                          at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:544)
                          at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:478)
                          at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:441)
                          at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:742)
                          at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:362)
                          at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:192)
                          at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:185)
                          at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:720)
                          at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:190)
                          at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:77)
                          at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:127)
                          at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147)
                          at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27)
                          at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:50)
                          at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:201)
                          at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:181)
                          at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:521)
                          at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
                          at com.example.android.happybirthday.MainActivity.onCreate(MainActivity.java:10)
                          at android.app.Activity.performCreate(Activity.java:5451)
                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
                          at android.app.ActivityThread.access$900(ActivityThread.java:169)
                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
                          at android.os.Handler.dispatchMessage(Handler.java:102)
                          at android.os.Looper.loop(Looper.java:146)
                          at android.app.ActivityThread.main(ActivityThread.java:5487)
                          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:1283)
                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
                          at dalvik.system.NativeStart.main(Native Method)
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41b38da0)
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.example.android.happybirthday, PID: 30844
                  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.happybirthday/com.example.android.happybirthday.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020052
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2334)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
                      at android.app.ActivityThread.access$900(ActivityThread.java:169)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:146)
                      at android.app.ActivityThread.main(ActivityThread.java:5487)
                      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:1283)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
                      at dalvik.system.NativeStart.main(Native Method)
                   Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020052
                      at android.content.res.Resources.loadDrawable(Resources.java:3066)
                      at android.content.res.Resources.getDrawable(Resources.java:1627)
                      at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:346)
                      at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:197)
                      at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:185)
                      at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:720)
                      at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:190)
                      at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:77)
                      at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:127)
                      at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147)
                      at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27)
                      at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:50)
                      at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:201)
                      at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:181)
                      at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:521)
                      at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
                      at com.example.android.happybirthday.MainActivity.onCreate(MainActivity.java:10)
                      at android.app.Activity.performCreate(Activity.java:5451)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392) 
                      at android.app.ActivityThread.access$900(ActivityThread.java:169) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:146) 
                      at android.app.ActivityThread.main(ActivityThread.java:5487) 
                      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:1283) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) 
                      at dalvik.system.NativeStart.main(Native Method) 
                   Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
                      at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:986)
                      at android.graphics.drawable.Drawable.createFromXml(Drawable.java:930)
                      at android.content.res.Resources.loadDrawable(Resources.java:3062)
                      at android.content.res.Resources.getDrawable(Resources.java:1627) 
                      at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:346) 
                      at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:197) 
                      at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:185) 
                      at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:720) 
                      at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:190) 
                      at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:77) 
                      at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:127) 
                      at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147) 
                      at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27) 
                      at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:50) 
                      at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:201) 
                      at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:181) 
                      at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:521) 
                      at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71) 
                      at com.example.android.happybirthday.MainActivity.onCreate(MainActivity.java:10) 
                      at android.app.Activity.performCreate(Activity.java:5451) 
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298) 
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392) 
                      at android.app.ActivityThread.access$900(ActivityThread.java:169) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:146) 
                      at android.app.ActivityThread.main(ActivityThread.java:5487) 
                      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:1283) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) 
                      at dalvik.system.NativeStart.main(Native Method) 
I/Process: Sending signal. PID: 30844 SIG: 9
Application terminated.

2 个答案:

答案 0 :(得分:0)

禁用项目的即时运行,清理并再次运行项目,它将起作用。

答案 1 :(得分:0)

首先检查您的drawable资源并确保其中存在abc_vector_test.xml,然后转到项目的工作区并删除app文件夹下的build文件夹,然后重建项目。