找不到从 Google Play Services Util 引用的 class
Could not find class referenced from Google Play Services Util
我已将 Google Analytics 添加到我的 Android 项目并按照所有说明进行操作,但我仍然在 LogCat 中收到这 2 条错误消息:
E/dalvikvm: Could not find class 'android.os.UserManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzah
W/dalvikvm: VFY: unable to resolve check-cast 276 (Landroid/os/UserManager;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzb
W/dalvikvm: VFY: unable to resolve check-cast 25 (Landroid/app/AppOpsManager;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
这实际上并没有使应用程序崩溃,但很高兴知道为什么会发生这种情况。
Android 清单(混淆):
<?xml version="1.0" encoding="utf-8"?>
<manifest
package="com.example.android"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:allowBackup="true"
android:allowClearUserData="true"
android:allowTaskReparenting="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:restoreAnyVersion="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<receiver
android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH"/>
</intent-filter>
</receiver>
<receiver
android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER"/>
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false"/>
<service android:name="com.google.android.gms.analytics.CampaignTrackingService"/>
</application>
</manifest>
你们中有人知道这个错误吗?
Gradle(缩写):
classpath 'com.android.tools.build:gradle:1.4.0-beta3'
classpath 'com.google.gms:google-services:1.4.0-beta3'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
参考Koh
"UserManager
需要 API 级别 17,而 AppOpsManager
需要 API 级别 19。[...] 否则,这可能是一个 multidex 问题,例如 ."
我已将 Google Analytics 添加到我的 Android 项目并按照所有说明进行操作,但我仍然在 LogCat 中收到这 2 条错误消息:
E/dalvikvm: Could not find class 'android.os.UserManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzah
W/dalvikvm: VFY: unable to resolve check-cast 276 (Landroid/os/UserManager;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzb
W/dalvikvm: VFY: unable to resolve check-cast 25 (Landroid/app/AppOpsManager;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
这实际上并没有使应用程序崩溃,但很高兴知道为什么会发生这种情况。
Android 清单(混淆):
<?xml version="1.0" encoding="utf-8"?>
<manifest
package="com.example.android"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:allowBackup="true"
android:allowClearUserData="true"
android:allowTaskReparenting="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:restoreAnyVersion="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<receiver
android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH"/>
</intent-filter>
</receiver>
<receiver
android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER"/>
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false"/>
<service android:name="com.google.android.gms.analytics.CampaignTrackingService"/>
</application>
</manifest>
你们中有人知道这个错误吗?
Gradle(缩写):
classpath 'com.android.tools.build:gradle:1.4.0-beta3'
classpath 'com.google.gms:google-services:1.4.0-beta3'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
参考Koh
"UserManager
需要 API 级别 17,而 AppOpsManager
需要 API 级别 19。[...] 否则,这可能是一个 multidex 问题,例如