【问题标题】:Getting duplicate resource error in gradle android在gradle android中获取重复资源错误
【发布时间】:2016-12-03 06:41:58
【问题描述】:

我在我的 android 应用程序中添加 google maps 和 firebase 消息传递,但是在将错误构建为重复资源之后。

我的日志猫错误是

Error:Execution failed for task ':app:mergeDebugResources'.
> [string/google_api_key] F:\Android Workspace\FoxindTracker\app\src\main\res\values\strings.xml    [string/google_api_key] F:\Android Workspace\FoxindTracker\app\build\generated\res\google-services\debug\values\values.xml: Error: Duplicate resources

我的编译依赖如下

compile 'com.android.support:appcompat-v7:24.+'
    compile 'com.android.support:design:24.+'
    //compile 'com.google.android.gms:play-services:9.4.0'
    compile 'com.google.android.gms:play-services-maps:9.0.0'
    compile 'com.google.firebase:firebase-messaging:9.0.0'
    compile 'com.android.support:cardview-v7:24.+'
    compile 'com.android.support:recyclerview-v7:24.+'
    compile 'org.igniterealtime.smack:smack-android:4.1.4'
    compile 'org.igniterealtime.smack:smack-tcp:4.1.4'
    compile 'org.igniterealtime.smack:smack-im:4.1.4'
    compile 'org.igniterealtime.smack:smack-extensions:4.1.4'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
//    compile 'com.squareup.retrofit2:converter-simplexml:2.1.0'
    compile ('com.squareup.retrofit2:converter-simplexml:2.1.0') {
        exclude group: 'xpp3', module: 'xpp3'
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'stax', module: 'stax'
    }
    compile('com.digits.sdk.android:digits:1.10.3@aar') {
        transitive = true;
    }
    compile "commons-io:commons-io:+"
    compile 'com.squareup.picasso:picasso:2.5.2'
}
apply plugin: 'com.google.gms.google-services'

请帮我看看我哪里错了

【问题讨论】:

  • 嗨莫希特。那么如何解决这个问题呢?
  • 我已经两次声明了相同的资源 ID。我删除了额外的资源。就是这样。
  • 感谢您的回复莫希特。解决了这个问题。

标签: android google-maps google-play-services firebase-cloud-messaging


【解决方案1】:

我会建议检查你的 string.xml 是否有重复或相同的字符串,你已经贴了双倍。所以你可以检查一次你的所有字符串资源

根据你的日志错误

google_api_key

是重复的字符串。我希望它会起作用。

【讨论】:

    【解决方案2】:

    只需将 google_api_key 重命名为 g_api_key 之类的名称即可。 Firebase 将其命名为 google_api_key,以便显示重复。我希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-22
      • 2015-06-13
      • 1970-01-01
      • 2017-04-18
      • 1970-01-01
      • 2019-05-09
      • 1970-01-01
      相关资源
      最近更新 更多