在某些设备中出现此错误导致应用程序崩溃..java.lang.NoClassDefFoundError:com.google.android.gms.R$string

在某些设备中出现此错误导致应用程序崩溃..java.lang.NoClassDefFoundError:com.google.android.gms.R$string,android,google-maps,google-play-services,Android,Google Maps,Google Play Services,我的应用程序运行在除某些三星设备外的所有设备上。。 这些设备例外 java.lang.NoClassDefFoundError: com.google.android.gms.R$string 我正在使用此依赖项- compile 'com.google.android.gms:play-services:8.4.0' 我找到了解决办法,这和游戏服务无关。这是棒棒糖制作前的多指标错误 根据这一点,在build.gradle中添加了多索引依赖项, 您需要向扩展应用程序的类添加以下@Overri

我的应用程序运行在除某些三星设备外的所有设备上。。 这些设备例外

java.lang.NoClassDefFoundError: com.google.android.gms.R$string
我正在使用此依赖项-

compile 'com.google.android.gms:play-services:8.4.0'

我找到了解决办法,这和游戏服务无关。这是棒棒糖制作前的多指标错误

根据这一点,在build.gradle中添加了多索引依赖项, 您需要向扩展
应用程序的类添加以下
@Override
方法:

public class FirebaseCntx extends Application {
    ...
    @Override
    protected void attachBaseContext(Context base) {

        super.attachBaseContext(base);
        MultiDex.install(this);
    }
    ...
}

我在三星tab 4.4.2设备上也遇到了同样的问题。问题不在于谷歌play服务。这是因为Gradle脚本中启用了多索引支持,但忘记了更新AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapp">
    <application
            android:name="android.support.multidex.MultiDexApplication" >
        ...
    </application>
</manifest>

...

将android:name添加到清单文件后,此问题将得到解决。

在否决投票前,请在此处留下评论或发布原因。请检查您的设备,是否安装了Google Play服务。@KundanKumarRoy您是否在应用程序中使用地图?@Dhruv是的,我是using@KundanKumarRoy你能分享一些与此相关的代码吗。