首次在Android 4.4上运行时应用崩溃

时间:2017-01-23 06:56:15

标签: android exception firebase

我正在使用Android工作室来构建我的应用 我有2个模拟器,第一个使用Android 6.0,第二个使用Android 4.4

我的应用程序在Android 6.0上完美运行但是当我在4.4上尝试时它会立即崩溃。

我尝试通过在第一行上设置断点来调试应用,但它没有到达第一行。它直接崩溃了。

我收到的错误信息不是很清楚,我不知道问题是什么以及如何解决。

01/23 17:26:16: Launching app
No apk changes detected since last installation, skipping installation of D:\__Schlogger\Android\Schlogger\app\build\outputs\apk\app-debug.apk
$ adb shell am force-stop com.asmgx.schlogger.app
$ adb shell am start -n "com.asmgx.schlogger.app/com.asmgx.schlogger.app.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.asmgx.schlogger.app | com.asmgx.schlogger.app.test
Waiting for application to come online: com.asmgx.schlogger.app | com.asmgx.schlogger.app.test
Waiting for application to come online: com.asmgx.schlogger.app | com.asmgx.schlogger.app.test
Waiting for application to come online: com.asmgx.schlogger.app | com.asmgx.schlogger.app.test
Connecting to com.asmgx.schlogger.app
I/dalvikvm: Debugger is active
I/System.out: Debugger has connected
I/System.out: waiting for debugger to settle...
Connected to the target VM, address: 'localhost:8607', transport: 'socket'
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1368)
W/dalvikvm: VFY: unable to resolve static field 7536 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;
D/dalvikvm: VFY: replacing opcode 0x60 at 0x000e
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x9cd52b20)
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.asmgx.schlogger.app, PID: 2822
                  java.lang.NoClassDefFoundError: com.google.android.gms.R$string
                      at com.google.android.gms.common.internal.zzai.<init>(Unknown Source)
                      at com.google.firebase.FirebaseOptions.fromResource(Unknown Source)
                      at com.google.firebase.FirebaseApp.zzek(Unknown Source)
                      at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
                      at android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
                      at android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
                      at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:136)
                      at android.app.ActivityThread.main(ActivityThread.java:5017)
                      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:779)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                      at dalvik.system.NativeStart.main(Native Method)
Disconnected from the target VM, address: 'localhost:8607', transport: 'socket'

----------------------------------------------- -------------------------------------------------- ----

在应用所提供的解决方案后,我又遇到了另一个错误,但仍然不知道它是什么意思?

01-23 03:02:29.954 9105-9105/? I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
01-23 03:02:29.954 9105-9105/? W/dalvikvm: VFY: unable to resolve virtual method 723: Landroid/content/res/TypedArray;.getType (I)I
01-23 03:02:29.954 9105-9105/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
01-23 03:02:29.964 9105-9105/? 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:720)
                                                         at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:654)
                                                         at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:617)
                                                         at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:745)
                                                         at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:365)
                                                         at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:195)
                                                         at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
                                                         at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
                                                         at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
                                                         at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
                                                         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:53)
                                                         at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
                                                         at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
                                                         at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:525)
                                                         at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:74)
                                                         at com.asmgx.schlogger.app.MainActivity.onCreate(MainActivity.java:78)
                                                         at android.app.Activity.performCreate(Activity.java:5231)
                                                         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                                                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
                                                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
                                                         at android.app.ActivityThread.access$800(ActivityThread.java:135)
                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
                                                         at android.os.Handler.dispatchMessage(Handler.java:102)
                                                         at android.os.Looper.loop(Looper.java:136)
                                                         at android.app.ActivityThread.main(ActivityThread.java:5017)
                                                         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:779)
                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                                                         at dalvik.system.NativeStart.main(Native Method)
01-23 03:02:29.964 9105-9105/? D/AndroidRuntime: Shutting down VM
01-23 03:02:29.964 9105-9105/? W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x9cd52b20)
01-23 03:02:29.974 9105-9105/? D/dalvikvm: GC_FOR_ALLOC freed 365K, 12% free 3858K/4380K, paused 3ms, total 3ms
01-23 03:02:29.974 9105-9105/? E/UncaughtException: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.asmgx.schlogger.app/com.asmgx.schlogger.app.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020054
                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
                                                        at android.app.ActivityThread.access$800(ActivityThread.java:135)
                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
                                                        at android.os.Handler.dispatchMessage(Handler.java:102)
                                                        at android.os.Looper.loop(Looper.java:136)
                                                        at android.app.ActivityThread.main(ActivityThread.java:5017)
                                                        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:779)
                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                                                        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 #0x7f020054
                                                        at android.content.res.Resources.loadDrawable(Resources.java:2101)
                                                        at android.content.res.Resources.getDrawable(Resources.java:700)
                                                        at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
                                                        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
                                                        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
                                                        at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
                                                        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
                                                        at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
                                                        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:53)
                                                        at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
                                                        at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
                                                        at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:525)
                                                        at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:74)
                                                        at com.asmgx.schlogger.app.MainActivity.onCreate(MainActivity.java:78)
                                                        at android.app.Activity.performCreate(Activity.java:5231)
                                                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
                                                        at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                        at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                        at android.os.Looper.loop(Looper.java:136) 
                                                        at android.app.ActivityThread.main(ActivityThread.java:5017) 
                                                        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:779) 
                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                        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:933)
                                                        at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
                                                        at android.content.res.Resources.loadDrawable(Resources.java:2097)
                                                        at android.content.res.Resources.getDrawable(Resources.java:700) 
                                                        at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374) 
                                                        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200) 
                                                        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188) 
                                                        at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723) 
                                                        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193) 
                                                        at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81) 
                                                        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:53) 
                                                        at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205) 
                                                        at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185) 
                                                        at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:525) 
                                                        at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:74) 
                                                        at com.asmgx.schlogger.app.MainActivity.onCreate(MainActivity.java:78) 
                                                        at android.app.Activity.performCreate(Activity.java:5231) 
                                                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 
                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
                                                        at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                        at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                        at android.os.Looper.loop(Looper.java:136) 
                                                        at android.app.ActivityThread.main(ActivityThread.java:5017) 
                                                        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:779) 
                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                        at dalvik.system.NativeStart.main(Native Method) 
01-23 03:02:29.974 9105-9130/? I/DynamiteModule: Considering local module com.google.android.gms.tagmanager:3 and remote module com.google.android.gms.tagmanager:8
01-23 03:02:29.974 9105-9130/? I/DynamiteModule: Selected remote version of com.google.android.gms.tagmanager, version >= 8
01-23 03:02:30.074 9105-9130/? W/GoogleTagManager: No container asset found in /assets/containers. Checking top level /assets directory for container assets.
01-23 03:02:30.194 9105-9130/? W/GoogleTagManager: Tag Manager's event handler WILL NOT be installed (no container loaded)
01-23 03:02:30.194 9105-9130/? I/GoogleTagManager: Tag Manager initilization took 218ms
01-23 03:02:30.194 9105-9130/? D/FA: Logging event (FE): _ae, Bundle[{_o=crash, timestamp=1485158549979, fatal=1}]
01-23 03:02:30.194 9105-9130/com.asmgx.schlogger.app V/FA: Using measurement service
01-23 03:02:30.204 9105-9130/com.asmgx.schlogger.app V/FA: Connection attempt already in progress
01-23 03:02:30.234 9105-9131/com.asmgx.schlogger.app D/dalvikvm: GC_FOR_ALLOC freed 454K, 14% free 3914K/4528K, paused 7ms, total 10ms
01-23 03:02:30.294 9105-9105/com.asmgx.schlogger.app E/AndroidRuntime: FATAL EXCEPTION: main
                                                                       Process: com.asmgx.schlogger.app, PID: 9105
                                                                       java.lang.RuntimeException: Unable to start activity ComponentInfo{com.asmgx.schlogger.app/com.asmgx.schlogger.app.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020054
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
                                                                           at android.app.ActivityThread.access$800(ActivityThread.java:135)
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                           at android.os.Looper.loop(Looper.java:136)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5017)
                                                                           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:779)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                                                                           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 #0x7f020054
                                                                           at android.content.res.Resources.loadDrawable(Resources.java:2101)
                                                                           at android.content.res.Resources.getDrawable(Resources.java:700)
                                                                           at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
                                                                           at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
                                                                           at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
                                                                           at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
                                                                           at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
                                                                           at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
                                                                           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:53)
                                                                           at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
                                                                           at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
                                                                           at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:525)
                                                                           at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:74)
                                                                           at com.asmgx.schlogger.app.MainActivity.onCreate(MainActivity.java:78)
                                                                           at android.app.Activity.performCreate(Activity.java:5231)
                                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
                                                                           at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                           at android.os.Looper.loop(Looper.java:136) 
                                                                           at android.app.ActivityThread.main(ActivityThread.java:5017) 
                                                                           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:779) 
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                                           at dalvik.system.NativeStart.main(Native Method) 
                                                                        Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector

2 个答案:

答案 0 :(得分:0)

在你的gradle中,设置

multiDexEnabled true

并在Application类中:

使用 MultiDexApplication

扩展Application类
@Override
    protected void attachBaseContext(Context base) {
        MultiDex.install(this);
        super.attachBaseContext(base);
    }

因为MultiDexApplication尚未扩展,所以它不能包含gms和任何其他dex类,因此它在启动gms String时会出错。

您可以在此处参考有关如何使用multidex的更多信息:

https://developer.android.com/studio/build/multidex.html

答案 1 :(得分:0)

尝试使用此

第1步:

转到您的依赖项并添加此行

compile 'com.android.support:multidex:1.0.1'

并在defaultConfig部分添加此

  defaultConfig {

        minSdkVersion xx
        targetSdkVersion xx
        versionCode x

        multiDexEnabled true
}

然后      创建一个名为eg MyApp.java

的类
        public class MyApp extends Application{


            @Override
            public void onCreate() {
                super.onCreate();

            }

            @Override
            protected void attachBaseContext(Context base) {
                super.attachBaseContext(base);
                MultiDex.install(this);
            }


        }

STEP:2

转到您的清单,然后在Application代码

中执行以下操作
<application
        android:name="MyApp"
         .
         .
         .