由于INSTALL_PARSE_FAILED_MANIFEST_MALFORMED,无法在模拟器上运行应用

问题描述 投票:0回答:1

我想在模拟器(Nexus 5X API 28 - Android 9)上运行我的应用程序,但是我收到此错误

2019-02-26 10:16:35.467 2006-2041/system_process W/PackageManager: Failed parse during installPackageLI
    android.content.pm.PackageParser$PackageParserException: /data/app/vmdl2060641397.tmp/base.apk (at Binary XML file line #58): Empty class name in package com.mycompany.tinyget
        at android.content.pm.PackageParser.parseBaseApk(PackageParser.java:1340)
        at android.content.pm.PackageParser.parseClusterPackage(PackageParser.java:1243)
        at android.content.pm.PackageParser.parsePackage(PackageParser.java:1020)
        at android.content.pm.PackageParser.parsePackage(PackageParser.java:1042)
        at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:17146)
        at com.android.server.pm.PackageManagerService.installPackageTracedLI(PackageManagerService.java:17080)
        at com.android.server.pm.PackageManagerService.access$3300(PackageManagerService.java:405)
        at com.android.server.pm.PackageManagerService$9.run(PackageManagerService.java:14996)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.os.HandlerThread.run(HandlerThread.java:65)
        at com.android.server.ServiceThread.run(ServiceThread.java:44)

每个帖子都提到不要在包名上使用大写字,但是我的包名没有大写字。

这是我的gradle文件;

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
    maven { url 'https://maven.google.com' }
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.mycompany.tinyget"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        manifestPlaceholders = [
                onesignal_app_id: 'be7a7e0c-198b-45ca-8e0a-595317fce0bd',
                onesignal_google_project_number: '965868429620'
        ]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

ext {
    permissonDispatcher = '4.0.0'
    googleMapsVersion = '16.1.0'
    googleLocationVersion = '16.0.0'
    supportLibraryVersion = '28.0.0'
    constraintLayoutVersion = '1.1.3'
}

dependencies {
    configurations {
        all*.exclude group: 'com.android.support', module: 'support-v13'
        compile.exclude group: 'androidx.annotation', module: 'annotation'
    }
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.multidex:multidex:2.0.1'

    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation "com.google.android.gms:play-services-maps:$googleMapsVersion"
    implementation "com.google.android.gms:play-services-location:$googleLocationVersion"
    implementation 'com.google.firebase:firebase-perf:16.2.3'
    implementation 'com.google.firebase:firebase-ads:17.1.3'
    implementation 'com.google.code.gson:gson:2.8.5'

    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1"

    implementation 'com.onesignal:OneSignal:3.10.3'

    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'

    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'

    implementation "com.github.hotchemi:permissionsdispatcher:$permissonDispatcher"
    kapt "com.github.hotchemi:permissionsdispatcher-processor:$permissonDispatcher"

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

我不知道如何解决这个问题。清单看起来不错但API 28时会出现问题。

我感谢任何帮助。谢谢。

编辑:清单文件

<?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.mycompany.tinyget">

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


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

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

        <activity android:name=".SettingsActivity" />

        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />

        <service
            android:name=".LocationService"
            android:enabled="true"
            android:exported="false" />

        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-7794206294575597~1926092514" />

    </application>

</manifest>
android gradle android-emulator
1个回答
1
投票
android:appComponentFactory=""

appComponentFactory属性不能为空。您可以将其删除以获取默认值。

© www.soinside.com 2019 - 2024. All rights reserved.