android - list 合并因多个错误而失败,请参阅日志 AndroidManifest.xml :requires a placeholder substitution but no value for

标签 android

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

Merging Errors: Error: Attribute meta-data#onesignal_app_id@value at AndroidManifest.xml:50:9-52:51 requires a placeholder substitution but no value for is provided. app main manifest (this file), line 49 Error: Attribute meta-data#onesignal_google_project_number@value at AndroidManifest.xml:54:9-56:70 requires a placeholder substitution but no value for is provided. app main manifest (this file), line 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
}

最佳答案

错误消息表明 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'
  ]

关于android - list 合并因多个错误而失败,请参阅日志 AndroidManifest.xml :requires a placeholder substitution but no value for,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57036520/

相关文章:

android - 如何授予不属于应用程序的文件的权限

java - Android上单个物理文件中的多个类

java - Android - 如何使用适配器类中的代码在布局文件中设置图像?

android - 如何在我键入时更新微调器 View ?

android - 使用 Apportable 向 Android Manifest 添加权限

android - 如何更改微调器的颜色而不是下拉项的颜色?

java - 返回跨字符串android

javascript - 如何在 Android 中的 Javascript 中捕获点击但不滚动?

java - http 请求免受 Android 攻击

java - 证书注册流程是什么?