2016-12-02 131 views
2

在我的Android项目中尝试安装OneSignal的SDK后,我注意到编译时一直出现错误,导致无法使用此服务。错误:清单合并失败,出现多个错误,请参阅日志

我build.grade(模块:应用程序)文件:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.2" 

    defaultConfig { 
     applicationId "com.sourcey.project" 
     minSdkVersion 17 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

repositories { 
    // maven central repository 
    mavenCentral() 

    maven { url "https://oss.sonatype.org/content/repositories/snapshots" } 

} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 

    compile 'com.android.support:appcompat-v7:24.2.1' 
    compile 'com.microsoft.azure:azure-mobile-android:3.1.0' 
    compile 'com.microsoft.azure.android:azure-storage-android:[email protected]' 
    compile 'com.android.support:design:24.2.1' 
    compile 'com.google.firebase:firebase-core:10.0.1' 
    compile 'com.google.firebase:firebase-messaging:10.0.1' 
    compile 'com.google.firebase:firebase-database:10.0.1' 
    compile 'com.google.android.gms:play-services:10.0.1' 
    compile 'com.miguelcatalan:materialsearchview:1.4.0' 
    compile 'com.afollestad.material-dialogs:core:0.9.1.0' 
    compile 'com.afollestad.material-dialogs:commons:0.9.1.0' 

    **compile 'com.onesignal:OneSignal:[email protected]' 
    compile 'com.google.android.gms:play-services-gcm:10.0.1' 
    compile 'com.google.android.gms:play-services-location:10.0.1' 
    compile 'com.google.android.gms:play-services-analytics:10.0.1'** 
//Without including these 4 rows, the project building process goes perfectly. 


    testCompile 'junit:junit:4.12' 
} 


apply plugin: 'com.google.gms.google-services' 

感谢您的帮助家伙!

+0

显示到logcat的或控制台什么错误? – Jorgesys

回答

-1

您的依赖关系部分中你有这样的:

**compile 'com.onesignal:OneSignal:[email protected]' 

当你sincronize您的项目,这将导致该问题。

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 

    compile 'com.android.support:appcompat-v7:24.2.1' 
    compile 'com.microsoft.azure:azure-mobile-android:3.1.0' 
    compile 'com.microsoft.azure.android:azure-storage-android:[email protected]' 
    compile 'com.android.support:design:24.2.1' 
    compile 'com.google.firebase:firebase-core:10.0.1' 
    compile 'com.google.firebase:firebase-messaging:10.0.1' 
    compile 'com.google.firebase:firebase-database:10.0.1' 
    compile 'com.google.android.gms:play-services:10.0.1' 
    compile 'com.miguelcatalan:materialsearchview:1.4.0' 
    compile 'com.afollestad.material-dialogs:core:0.9.1.0' 
    compile 'com.afollestad.material-dialogs:commons:0.9.1.0' 

    **compile 'com.onesignal:OneSignal:[email protected]' 
    compile 'com.google.android.gms:play-services-gcm:10.0.1' 
    compile 'com.google.android.gms:play-services-location:10.0.1' 
    compile 'com.google.android.gms:play-services-analytics:10.0.1'** 
//Without including these 4 rows, the project building process goes perfectly. 


    testCompile 'junit:junit:4.12' 
} 
+0

添加了星号以标记有问题的块。 删除此特定行将不会安装OneSignal的SDK,这就是添加这4行的全部目的。 –

+0

哪些错误消息显示在日志中? – Jorgesys

1

修复: 忘了添加 -

manifestPlaceholders = [onesignal_app_id: "PUT YOUR ONESIGNAL APP ID HERE", 
           // Project number pulled from dashboard, local value is ignored. 
           onesignal_google_project_number: "REMOTE"] 
+0

你在哪添加这个 – Tariqul