代码之家  ›  专栏  ›  技术社区  ›  Ashhar Jawaid

应用程序无法启动:应用程序未安装错误

  •  0
  • Ashhar Jawaid  · 技术社区  · 7 年前

    我正在构建一个具有系统级权限的应用程序,并获得了移动制造商的签名。

    生成的签名apk正在安装中,但当我尝试从菜单打开应用程序时,它表示应用程序未安装。

    下面是应用程序的清单文件。欢迎提出任何建议

    <?xml version="1.0" encoding="utf-8"?>
    <manifest package="com.mjawaid.nwlogger"
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:sharedUserId="android.uid.system">
    
    <!-- <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/> -->
    <!-- <uses-permission android:name="android.permission.WRITE_SETTINGS"/> -->
    <!-- <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL"/>
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> -->
    
    <!--<uses-feature android:name="android.hardware.telephony">
    </uses-feature> -->
    
    <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"
        android:sharedUserId="android.uid.system">
        <activity
            android:name="com.mjawaid.nwlogger.MainActivity"
            android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:name="com.mjawaid.nwlogger.NWOptionsActivity"/>
        <activity android:name="com.mjawaid.nwlogger.helper.silentlog.SilentLogSprdOption">
        </activity>
    </application>
    

    下面是应用程序版本。gradle,如果这有帮助的话。

    apply plugin: 'com.android.application' 
    android {
    compileSdkVersion 27
    signingConfigs {
        config {
            storeFile file("test.keystore")
            storePassword "xxxxxx"
            keyAlias "xxxxxx"
            keyPassword "xxxxxx"
        }
    }
    
    defaultConfig {
        applicationId "com.mjawaid.nwlogger"
        minSdkVersion 22
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        signingConfig signingConfigs.config
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    
    buildTypes {
        release {
            debuggable false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
            android.applicationVariants.all { variant ->
                variant.outputs.all {
                    outputFileName = "NWLogger-vRel.apk"
                }
            }
    
            /*applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    output.outputFileName = new File(output.outputFileName.parent,
                            output.outputFileName.name.replace("app-release", "NWLogger")
                            //for Debug use output.outputFile = new File(output.outputFile.parent,
                            //                             output.outputFile.name.replace("-debug", "-" + formattedDate)
                    )
                }
            }*/
        }
        debug {
            debuggable false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
    
            android.applicationVariants.all { variant ->
                variant.outputs.all {
                    outputFileName = "NWLogger-vDebug.apk"
                }
            }
    
            /*applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    output.outputFileName = new File(output.outputFileName.parent,
                            output.outputFileName.name.replace("app-debug", "BTStabilityTest")
                            //for Debug use output.outputFile = new File(output.outputFile.parent,
                            //                             output.outputFile.name.replace("-debug", "-" + formattedDate)
                    )
                }
            }*/
        }
    }
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:27.0.2'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    }
    }
    
    3 回复  |  直到 7 年前
        1
  •  0
  •   Arpan Sarkar    7 年前

    如果您有root访问权限,请尝试将应用程序放入 /system/priv-app 手动重启设备,然后尝试从菜单打开。

        2
  •  0
  •   Ankit Mehta    7 年前

    尝试清理构建,然后需要创建签名的apk。

        3
  •  0
  •   Ashhar Jawaid    7 年前

    似乎错误是由于我添加了 android:exported="false" 我的启动器活动似乎导致了问题。

    删除属性解决了我的问题。