失败[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]

时间:2015-10-17 03:37:27

标签: android android-intent android-service android-broadcast android-windowmanager

我正在开发一个安全应用程序,因为我需要捕获或检测用户输入的错误密码。我在android studio上使用API​​级别22进行此操作。但什么也没发生。它显示错误。

"Installing com.example.sourav.myfirstapp DEVICE SHELL COMMAND: pm
install -r "/data/local/tmp/com.example.sourav.myfirstapp"  pkg:
/data/local/tmp/com.example.sourav.myfirstapp Failure
[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]"

以下是我的代码的详细信息:

主要活动 -

 public class AdminReceiver extends DeviceAdminReceiver {
    @Override
    public void onPasswordChanged(Context ctxt, Intent intent) {
    DevicePolicyManager mgr=
            (DevicePolicyManager)ctxt.getSystemService(Context.DEVICE_POLICY_SERVICE);
    int msgId;

    if (mgr.isActivePasswordSufficient()) {
        msgId=R.string.compliant;
    }
    else msgId = R.string.not_compliant;

    Toast.makeText(ctxt, msgId, Toast.LENGTH_LONG).show();
}

@Override
public void onPasswordFailed(Context ctxt, Intent intent) {
    Toast.makeText(ctxt, "u will never break!", Toast.LENGTH_LONG)
            .show();
    String tag="tag";
    Log.v(tag,"this massage from error" );
}

@Override
public void onPasswordSucceeded(Context ctxt, Intent intent) {
    Toast.makeText(ctxt, "good u enterd", Toast.LENGTH_LONG)
            .show();
    String tag="tag";
    Log.v(tag, "this massage from success");
}
}`

清单 -

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.sourav.myfirstapp" >

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme" >

        <receiver
            android:name="AdminReceiver"
            android:permission="android.permission.BIND_DEVICE_ADMIN">
            <meta-data
                android:name="android.app.device_admin"
                />

            <intent-filter>

                <action    android:name="android.app.action.ACTION_PASSWORD_FAILED"/>
                <action android:name="android.app.action.ACTION_PASSWORD_SUCCEEDED"/>
            </intent-filter>
        </receiver>
    </application>

</manifest>

元数据 -

<device-admin xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-policies>
        <limit-password/>

        <watch-login/>
    </uses-policies>

</device-admin>

0 个答案:

没有答案