某些设备上的Android Studio Error..Works而不是其他设备

时间:2016-06-10 08:16:40

标签: android android-studio

这是我的错误。

  

致命的例外:主要                                                                          过程:com.rahulapps.voiceofmp,PID:8980                                                                          java.lang.NoClassDefFoundError:com.google.firebase.FirebaseOptions                                                                              在com.google.firebase.FirebaseApp.zzbu(未知来源)                                                                              在com.google.firebase.provider.FirebaseInitProvider.onCreate(未知   资源)                                                                              在   android.content.ContentProvider.attachInfo(ContentProvider.java:1616)                                                                              在   android.content.ContentProvider.attachInfo(ContentProvider.java:1587)                                                                              在   com.google.firebase.provider.FirebaseInitProvider.attachInfo(未知   资源)                                                                              在   android.app.ActivityThread.installProvider(ActivityThread.java:4886)                                                                              在   android.app.ActivityThread.installContentProviders(ActivityThread.java:4481)                                                                              在   android.app.ActivityThread.handleBindApplication(ActivityThread.java:4421)                                                                              在android.app.ActivityThread.access $ 1500(ActivityThread.java:141)                                                                              在   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1272)                                                                              在android.os.Handler.dispatchMessage(Handler.java:102)                                                                              在android.os.Looper.loop(Looper.java:136)                                                                              在android.app.ActivityThread.main(ActivityThread.java:5113)                                                                              at java.lang.reflect.Method.invokeNative(Native Method)                                                                              在java.lang.reflect.Method.invoke(Method.java:515)                                                                              在   com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:793)                                                                              在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)                                                                              在dalvik.system.NativeStart.main(本地方法)

我的应用程序gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'

    defaultConfig {
        applicationId "com.rahulapps.voiceofmp"
        minSdkVersion 16
        targetSdkVersion 23
        multiDexEnabled true
    }

    lintOptions {
        checkReleaseBuilds false
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

    buildTypes {
        release {
            //minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    dexOptions {
        incremental true
    }
}

dependencies {
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile files('libs/http-core-4.1.jar')
    compile files('libs/httpclient.jar')
    compile files('libs/Parse-1.3.0.jar')
    compile files('libs/StartAppInAppPlus-2.3.jar')
    compile files('libs/universal-image-loader-1.9.5.jar')

}

2 个答案:

答案 0 :(得分:0)

它的GPS依赖性。

  • 使用最新版本
  • 请勿使用完整的Google Play服务套装。只需使用您需要的组件。
  • 并尝试始终使用特定版本而不是+

替换

'com.google.android.gms:play-services:+'

您需要具备以下内容:

Google+ com.google.android.gms:play-services-plus:9.0.2
Google Account Login    com.google.android.gms:play-services-auth:9.0.2
Google Actions, Base Client Library com.google.android.gms:play-services-base:9.0.2
Google Address API  com.google.android.gms:play-services-identity:9.0.2
Google App Indexing com.google.android.gms:play-services-appindexing:9.0.2
Google App Invites  com.google.android.gms:play-services-appinvite:9.0.2
Google Analytics    com.google.android.gms:play-services-analytics:9.0.2
Google Cast com.google.android.gms:play-services-cast:9.0.2
Google Cloud Messaging  com.google.android.gms:play-services-gcm:9.0.2
Google Drive    com.google.android.gms:play-services-drive:9.0.2
Google Fit  com.google.android.gms:play-services-fitness:9.0.2
Google Location, Activity Recognition, and Places   com.google.android.gms:play-services-location:9.0.2
Google Maps com.google.android.gms:play-services-maps:9.0.2
Google Mobile Ads   com.google.android.gms:play-services-ads:9.0.2
Mobile Vision   com.google.android.gms:play-services-vision:9.0.2
Google Nearby   com.google.android.gms:play-services-nearby:9.0.2
Google Panorama Viewer  com.google.android.gms:play-services-panorama:9.0.2
Google Play Game services   com.google.android.gms:play-services-games:9.0.2
SafetyNet   com.google.android.gms:play-services-safetynet:9.0.2
Android Pay com.google.android.gms:play-services-wallet:9.0.2
Android Wear    com.google.android.gms:play-services-wearable:9.0.2

official documentation中阅读更多内容。

答案 1 :(得分:0)

请在gradle中添加此代码:

aaptOptions{
    additionalParameters "--no-version-vectors"
}