清单合并失败,出现多个错误,请参阅日志AndroidManifest.xml:需要占位符替换,但没有值

时间:2019-07-15 09:09:23

标签: android

以下是意外错误。我该如何调试呢?

  

合并错误:错误:AndroidManifest.xml:50:9-52:51处的属性meta-data#onesignal_app_id @ value需要占位符替换,但未提供任何值。应用程序主清单(此文件),第49行错误:AndroidManifest.xml:54:9-56:70中的属性meta-data#onesignal_google_project_number @ value需要占位符替换,但未提供任何值。应用主清单(此文件),第53行

代码:

?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.muhammadtehmoor.my_fyp">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-feature android:name="android.hardware.camera2" />
    <uses-feature android:name="android.hardware.camera" />


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
       </application>
</manifest>

这是我的build.gradle(应用程序级别)。我已经从Android Studio中的Firebase插件导入了大多数依赖项。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
//    buildToolsVersion '26.0.1'
    defaultConfig {
        applicationId "com.muhammadtehmoor.my_fyp"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false


        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:11.0.4'
    implementation 'com.google.firebase:firebase-database:11.0.4'
    implementation 'com.google.firebase:firebase-storage:11.0.4'
    testImplementation 'junit:junit:4.12'
    implementation 'com.hbb20:ccp:2.1.9'
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
    implementation 'androidx.multidex:multidex:2.0.0'
    implementation 'com.alimuzaffar.lib:animated-edit-text:2.0.2'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.google.android.gms:play-services-maps:11.0.4'
    implementation 'com.google.android.gms:play-services-gcm:11.0.4'
    implementation 'com.google.android.gms:play-services-location:11.0.4'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'com.github.d-max:spots-dialog:1.1@aar'
    implementation 'com.onesignal:OneSignal:3.+@aar'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    implementation 'me.spark:submitbutton:1.0.1'
    //glidle
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    implementation 'com.github.Mahfa:DayNightSwitch:1.2'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
    //firebase ui
//    implementation 'com.firebaseui:firebase-ui-auth:3.1.0'
//    implementation 'com.google.android.gms:play-services-auth:11.0.4'

}

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


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

这是我的build.gradle(项目:my_Fyp)。我已经从Android Studio中的Firebase插件导入了大多数依赖项。

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
        mavenCentral()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        //classpath 'com.google.gms:google-services:3.1.0'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

//configurations.all {
//    resolutionStrategy.force 'com.android.support:support-v4:27.1.0'
//}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io'}
        maven {url 'https://dl.bintray.com/spark/maven'}
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

2 个答案:

答案 0 :(得分:0)

该错误消息表明OneSignal库配置不正确。从他们的setup instructions看,似乎您错过了1.3点。 将此添加到应用程序级别build.gradle;中。在android / defaultConfig标签内:

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

答案 1 :(得分:0)

这可能有帮助...

尝试去你的

<块引用>

android/app/build.gradle

找到 defaultConfig 并添加以下内容

清单占位符 = [ onesignal_app_id: 'ONE SIGNAL APP ID', // 从仪表板拉取的项目编号,忽略本地值。 onesignal_google_project_number: '远程' ]

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.app.android"
    ...
    manifestPlaceholders = [
        onesignal_app_id: 'ONE SIGNAL APP ID HERE',
        // Project number pulled from dashboard, local value is ignored.
        onesignal_google_project_number: 'REMOTE'
    ]
}

您的 Onesignal Google 项目编号是您的 Firebase 发件人 ID。