我正在构建具有系统级权限的应用,并由移动设备制造商签名。
已生成已签名的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>
以下是app build.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'
}
}
答案 0 :(得分:0)
如果您拥有超级用户权限,请尝试手动将应用置于/system/priv-app
内,然后重新启动设备并尝试从菜单中打开。
答案 1 :(得分:0)
尝试清理构建,然后您需要创建签名的apk。
答案 2 :(得分:0)
似乎错误是因为我将android:exported="false"
添加到我的启动器活动中,这似乎导致了问题。
删除属性解决了我的问题。