2016年1月11日 星期一

[Exception] couldn't find class 'com.google.android.gms.measurement.internal.zzz'

References:

http://stackoverflow.com/questions/33196015/error-on-some-devices-couldnt-find-class-com-google-android-gms-measurement

Error log:

01-12 14:45:58.910    4347-4347/? E/dalvikvm﹕ Could not find class 'com.google.android.gms.measurement.internal.zzx', referenced from method com.google.android.gms.measurement.internal.zzt.zzaU

    java.lang.VerifyError: com/google/android/gms/measurement/internal/zzt
            at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source)
            at android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
            at android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
            at android.app.ActivityThread.installProvider(ActivityThread.java:4897)
            at android.app.ActivityThread.installContentProviders(ActivityThread.java:4487)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4427)
            at android.app.ActivityThread.access$1500(ActivityThread.java:143)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1302)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5124)
            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:797)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:613)
            at dalvik.system.NativeStart.main(Native Method)

Code snippet:

MyApplication.java
public class MyApplication extends Application {

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

AndroidManifest.xml
<application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/xxxxxx"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

Solution:

This happens because of multi-dexing. When your code is so big that it can't be compiled with a single dex file, we use multidexing. But after that it wouldn't run on all phones

沒有留言: