Не удается прочитать packageName из AndroidManifest.xml после незначительных изменений

Я внес некоторые незначительные изменения в свое приложение, но теперь, когда я пытаюсь создать свое приложение, я получаю эту ошибку, в которой говорится, что Невозможно прочитать имя пакета из AndroidManifest.xml, я опубликую здесь свойства манифеста и градиента, чтобы вы могли лучше понять, что происходит: Манифест

 <?xml version = "1.0" encoding = "utf-8"?>
<manifest xmlns:android = "http://schemas.android.com/apk/res/android"
    xmlns:tools = "http://schemas.android.com/tools"
    package = "com.soheil.prolightfa"
    android:installLocation = "auto"
    android:versionCode = "24"
    android:versionName = "4.6.1">

    <uses-sdk
        android:minSdkVersion = "17"
        android:targetSdkVersion = "28" />


    <uses-permission android:name = "android.permission.CAMERA" />
    <uses-permission android:name = "android.permission.FLASHLIGHT" />
    <uses-permission android:name = "android.permission.INTERNET" />
    <uses-permission android:name = "android.permission.ACCESS_NETWORK_STATE" />

    <uses-feature android:name = "android.hardware.camera" />
    <uses-feature android:name = "android.hardware.camera.autofocus" />

    <uses-permission android:name = "android.permission.WAKE_LOCK" />

    <uses-feature android:name = "android.hardware.camera.flash" />

    <uses-permission android:name = "android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name = "android.permission.BATTERY_STATS"
        tools:ignore = "ProtectedPermissions" />
    <uses-permission android:name = "android.permission.DISABLE_KEYGUARD" />
    <uses-permission android:name = "android.permission.WRITE_EXTERNAL_STORAGE" />

    <!-- pushe -->
    <permission
        android:name = "com.soheil.prolightfa.permission.C2D_MESSAGE"
        android:protectionLevel = "signature" />

    <uses-permission android:name = "com.soheil.prolightfa.permission.C2D_MESSAGE" />
    <uses-permission android:name = "android.permission.READ_PHONE_STATE" />
    <uses-permission android:name = "android.permission.READ_EXTERNAL_STORAGE" /> <!-- pushe -->
    <application
        android:allowBackup = "true"
        android:icon = "@drawable/lablelasli"
        android:label = "@string/labelasli"
        android:logo = "@drawable/lablelasli"
        android:theme = "@style/AppTheme"
        tools:replace = "android:label"
        tools:ignore = "GoogleAppIndexingWarning">
        <activity
            android:name = ".MainActivity"
            android:configChanges = "keyboardHidden|orientation|screenSize"
            android:label = "@string/labelasli"
            android:launchMode = "singleInstance"
            android:screenOrientation = "portrait">
            <intent-filter>
                <action android:name = "android.intent.action.MAIN" />

                <category android:name = "android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!-- service flashlight -->
        <service
            android:name = ".utils.FlashlightService"
            android:exported = "false" />

        <activity
            android:name = ".screenlight"
            android:label = "@string/app_name"
            android:screenOrientation = "portrait"
            android:theme = "@android:style/Theme.NoTitleBar.Fullscreen" />
        <activity
            android:name = ".policesiren"
            android:label = "@string/app_name"
            android:screenOrientation = "portrait"
            android:theme = "@android:style/Theme.NoTitleBar.Fullscreen" />
        <activity
            android:name = ".ambulance"
            android:label = "@string/app_name"
            android:screenOrientation = "portrait"
            android:theme = "@android:style/Theme.NoTitleBar.Fullscreen" />
        <activity
            android:name = ".firetruck"
            android:label = "@string/app_name"
            android:screenOrientation = "portrait"
            android:theme = "@android:style/Theme.NoTitleBar.Fullscreen" />
        <activity
            android:name = ".constrc"
            android:label = "@string/app_name"
            android:screenOrientation = "portrait"
            android:theme = "@android:style/Theme.NoTitleBar.Fullscreen" />
        <activity
            android:name = ".camflash"
            android:label = "@string/app_name"
            android:screenOrientation = "portrait"
            android:theme = "@android:style/Theme.NoTitleBar.Fullscreen" />
        <activity
            android:name = ".disco"
            android:label = "@string/app_name"
            android:screenOrientation = "portrait"
            android:theme = "@android:style/Theme.NoTitleBar.Fullscreen" />
        <activity
            android:name = ".more"
            android:label = "@string/labelasli"
            android:theme = "@style/AppTheme" />

        <receiver android:name = ".widget">
            <meta-data
                android:name = "android.appwidget.provider"
                android:resource = "@xml/widgetinfo" />

            <intent-filter>
                <action android:name = "android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>
        </receiver>
        <!-- pushe -->
        <receiver android:name = "co.ronash.pushe.receiver.UpdateReceiver">
            <intent-filter>
                <action android:name = "android.intent.action.PACKAGE_REPLACED" />

                <data
                    android:path = "com.soheil.prolightfa"
                    android:scheme = "package" />
            </intent-filter>
        </receiver>
        <receiver
            android:name = "com.google.android.gms.gcm.GcmReceiver"
            android:exported = "true"
            android:permission = "com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name = "com.google.android.c2dm.intent.RECEIVE" />
                <action android:name = "com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name = "com.soheil.prolightfa" />
            </intent-filter>
        </receiver>

        <meta-data
            android:name = "co.ronash.pushe.token"
            android:value = "PUSHE_4xxxxxx" />
        <!-- pushe -->

        <activity android:name = ".morseract" />
        <activity
            android:name = ".Color"
            android:screenOrientation = "landscape"
            android:theme = "@android:style/Theme.NoTitleBar.Fullscreen" />

        <receiver android:name = ".utils.DisplayNotifications" />


        <meta-data
            android:name = "com.google.android.gms.ads.AD_MANAGER_APP"
            android:value = "true"/>
        <meta-data
            android:name = "com.google.android.gms.ads.APPLICATION_ID"
            android:value = "xxxxxxx"/>

    </application>

и вот как выглядит мой градиент

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
buildscript {
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url 'https://dl.bintray.com/woxingxiao/maven' }
        maven { url 'https://dl.bintray.com/android/android-tools' }

    }
    dependencies {
        // Add dependency
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:4.2.0'

    }
}
apply plugin: 'com.android.application'


dependencies {
    //crashlytics
    // Check for v11.4.2 or higher
    implementation 'com.google.firebase:firebase-core:16.0.7'
    //
    //    // Add dependency
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
    //pushe
    implementation project(':pushe-lib-1.2.0')
    //adad
    implementation 'ir.adad:androidsdk:5.0.0'
    //seekbar
    implementation fileTree(include: '*.jar', dir: 'libs')
    implementation 'com.github.rtugeek:colorseekbar:1.7.2'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.xw.repo:bubbleseekbar:3.5-lite'
    implementation 'com.auth0:java-jwt:2.1.0'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.android.gms:play-services-gcm:16.1.0'
    implementation 'com.google.android.gms:play-services-ads:17.1.3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-config:16.3.0'
    implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
        transitive = true
    }
}

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            }
        }

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

Все остальное правильно я считаю.

1
0
1 423
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

Я не вижу вашего applicationId в определении android { }.

// ...
android {
    // ...
    defaultConfig {
        applicationId "com.soheil.prolightfa"
    }
    // ...
}
// ...

просмотрите документацию и исправьте файл Gradle developer.android.com/studio/build/index.html#уровень модуля, затем вы можете удалить ненужные ссылки из AndroidManifest.xml

madlymad 06.04.2019 23:20

Спасибо, я исправил свою градацию и удалил последнюю строку градации !apply plugin: 'com.google.gms.google-services'

Soheyl 06.04.2019 23:43

Другие вопросы по теме