不幸的是,包安装程序已经停止了android

时间:2016-05-07 17:54:38

标签: android xml android-studio

我想在android中创建一个动态壁纸。我的应用程序在模拟器上工作正常,但在我的手机上,我无法安装它。

这是我的AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>

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

    <service
        android:name="GIFWallpaperService"
        android:enabled="true"
        android:label="Wallpaper Example "
        android:permission="android.permission.BIND_WALLPAPER" >
        <intent-filter>
            <action android:name="android.service.wallpaper.WallpaperService" >
            </action>
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

        <meta-data
            android:name="android.service.wallpaper"
            android:resource="@xml/wallpaper" >
        </meta-data>
    </service>
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

wallpaper.xml:

    <?xml version="1.0" encoding="UTF-8"?>
<wallpaper
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="GIF Wallpaper"
    android:debuggable="false"
    android:thumbnail="@mipmap/ic_launcher">
</wallpaper>

每当我尝试在模拟器上运行我的代码时,一切正常,但是当我复制时 “app-debug”到我的手机并尝试安装它不起作用。 安装完成后,我有两个选择:

  1. 打开应用。
  2. 完成。
  3. 如果我点击完成没有任何操作,之后如果我点击已安装的应用图标,则会显示app is not installed

    如果我在安装结束时点击“打开”,则会显示unfortunately package installer has stopped android

2 个答案:

答案 0 :(得分:0)

Debuggable设置为false对吗?这是不是意味着你不能用它调试?尝试删除'android:debuggable =“false”,'并查看它是否有效。

答案 1 :(得分:0)

我在这里找到了答案: Android Permission Denial starting Intent for Wallpaper Settings

我在错误的地方android:permission="android.permission.BIND_WALLPAPER"