[英]Error on some devices - couldn't find class 'com.google.android.gms.measurement.internal.zzz'
I am working on an Android Custom Launcher. 我正在开发Android Custom Launcher。 The application runs perfectly on some phones but do not start on others. 该应用程序在某些手机上运行完美,但不会在其他手机上运行。 On launching the application the following error occurs. 启动应用程序时,会发生以下错误。
E/dalvikvm﹕ Could not find class 'com.google.android.gms.measurement.internal.zzz', referenced from method com.google.android.gms.measurement.internal.zzv.zzaL
E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.VerifyError: com/google/android/gms/measurement/internal/zzv
at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1651)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1622)
at android.app.ActivityThread.installProvider(ActivityThread.java:5016)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4590)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4530)
at android.app.ActivityThread.access$1500(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1385)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5300)
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:830)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:646)
at dalvik.system.NativeStart.main(Native Method)
So after a lot of searching i came to know that this problem was due to the multidexing. 因此经过大量搜索后我才知道这个问题是由于多索引引起的。 On some phones multidexing don't work. 在某些手机上,多索引不起作用。 May be due to their Android Version. 可能是因为他们的Android版本。 However i fixed this by introductng an application class 但是我通过介绍一个应用程序类来解决这个问题
public class MyApplication extends Application {
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
and in menifest i entered the name in application tag like: 在清单中,我在应用程序标签中输入了名称,如:
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@mipmap/xxxxxx"
android:label="@string/app_name"
android:manageSpaceActivity="xxxxxxxxxx"
android:theme="@style/AppTheme" >
+) Building Apps with Over 65K Method will cause this Error. +)使用超过65K方法构建应用程序将导致此错误。
+) When your application and the libraries it references reach a certain size ( DEX file of your application can have total number of methods upto 65,536 including Android framework methods, library methods, and methods in your own code), you encounter build errors that indicate your app has reached a limit of the Android app build architecture. +)当您的应用程序及其引用的库达到一定大小时(应用程序的DEX文件可以包含高达65,536的方法总数,包括Android框架方法,库方法和您自己的代码中的方法),您会遇到构建错误,指示您的应用已达到Android应用构建体系结构的限制。
+) To resolve it, include Multidex Configuration in your build.gradle like the highlighted one in picture, along with this override the attachBaseContext(Context base) method in your Application class with the below content. +)要解决此问题, 请在build.gradle中包含Multidex Configuration ,如图中突出显示的那样,以及覆盖Application类中具有以下内容的attachBaseContext(Context base)方法。
public class YourParentApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Add this in you Androidmanifest.xml: 在你的Androidmanifest.xml中添加:
<application
android:name=".YourParentApplication"
android:allowBackup="true"
android:icon="@drawable/radiius_logo"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/MyMaterialTheme">
For more information about Multidex refer these sites: http://developer.android.com/tools/building/multidex.html 有关Multidex的更多信息,请参阅以下网站: http : //developer.android.com/tools/building/multidex.html
How to enable multidexing with the new Android Multidex support library 如何使用新的Android Multidex支持库启用多索引
It is due to multidexing, your application uses more than 64k methods update your 这是由于多索引,您的应用程序使用超过64k的方法更新您的
build.gradle(app level) with build.gradle(app level)
defaultConfig{ defaultConfig {
..... .....
multiDexEnabled true multiDexEnabled是的
} }
dependencies{ 依赖{
..... .....
compile 'com.android.support:multidex:1.0.1' 编译'com.android.support:multidex:1.0.1'
} }
and 和
@Override @覆盖
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
in your Application Class 在您的应用程序类中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.