当我将eclipse项目导入Android studio时,我有GCM类错误

时间:2016-05-05 22:14:35

标签: android

我有GCMBaseIntentService错误。当我将项目Eclipse导入Android Studio时会出现此问题

public class GCMIntentService extends GCMBaseIntentService

以下是依赖项我添加了很多依赖项,但问题未解决

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.totalsoft.thearena"
        minSdkVersion 9
        targetSdkVersion 17
    }

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

dependencies {
    compile 'com.google.code.gson:gson:2.2.1'
    compile files('libs/acra.jar')
    compile files('libs/commons-httpclient-3.0.1.jar')
    compile files('libs/ormlite-android-4.45.jar')
    compile files('libs/ormlite-core-4.45.jar')
    compile 'com.google.gms:google-services:2.0.0-alpha6'

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

    compile files('libs/gcm.jar')
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.google.maps:google-maps-services:0.1.3'
    compile 'com.google.android.gms:play-services:6.5.87'

    compile 'com.android.support:appcompat-v7:19.1.0'
    compile 'com.google.android.gms:play-services:4.2.42'
    compile 'org.apache.commons:commons-lang3:3.2.+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:+'
    compile 'com.android.support:appcompat-v7:20.+'

}

1 个答案:

答案 0 :(得分:1)

GCMIntentService已被弃用。从GitHub thread开始,它会引导您到Android Developer's Blog,提到它:

  

...已弃用GCMBaseIntentService类。请改用GoogleCloudMessaging API

如果您仍想尝试继续执行已有的实施。你可以参考这个similar post。似乎由于GCMIntentService已被弃用,它不再包含在Play服务库中。从帖子:

  

经过很多谷歌我发现这个类不在google_play_service库中,但它在gcm.jar中,现在已弃用。我不知道为什么谷歌给出了旧代码的链接,并解释了文档中的最新代码。

在哪里可以找到gcm.jar文件?那,我不确定。找到可能对您有所帮助的answer。但是看到它被回答后已经好几年了,我建议你只使用新的GoogleCloudMessaging API

干杯! :d

相关问题