java 某些设备上的错误 - 找不到类“com.google.android.gms.measurement.internal.zzz”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33196015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error on some devices - couldn't find class 'com.google.android.gms.measurement.internal.zzz'
提问by AqibBangash
I am working on an Android Custom Launcher. The application runs perfectly on some phones but do not start on others. On launching the application the following error occurs.
我正在开发 Android 自定义启动器。该应用程序在某些手机上运行良好,但在其他手机上无法启动。启动应用程序时出现以下错误。
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.access00(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)
回答by AqibBangash
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. However i fixed this by introductng an application class
所以经过大量搜索后,我才知道这个问题是由于多索引造成的。在某些手机上,多索引不起作用。可能是由于他们的 Android 版本。但是我通过引入一个应用程序类来解决这个问题
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:
在menifest中,我在应用程序标签中输入了名称,例如:
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@mipmap/xxxxxx"
android:label="@string/app_name"
android:manageSpaceActivity="xxxxxxxxxx"
android:theme="@style/AppTheme" >
回答by anand krish
+) Building Apps with Over 65K Method will cause this Error.
+) 使用超过 65K 的方法构建应用程序将导致此错误。
+) When your application and the libraries it references reach a certain size ( DEX fileof your application can have total number of methods upto 65,536including 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 Configurationin your build.gradlelike 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
回答by Mansuu....
It is due to multidexing, your application uses more than 64k methods update your
这是由于多索引,您的应用程序使用超过 64k 的方法更新您的
build.gradle(app level) with
build.gradle(应用程序级别)与
defaultConfig{
默认配置{
.....
.....
multiDexEnabled true
multiDexEnabled true
}
}
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
在您的应用程序类中