Android动态壁纸在Amazon App Store上崩溃测试ActivityNotFoundException

时间:2015-03-06 14:18:41

标签: android live-wallpaper amazon-appstore

我正在尝试将我的动态壁纸放在亚马逊App Store上(此动态壁纸已经在Google Play商店中播放),但是,当我在亚马逊开发者网站上传相同的APK进行测试时,它会报告异常

  

03-06 06:00:50.741 7598 7598 E AndroidRuntime:致命异常:主要   03-06 06:00:50.741 7598 7598 E AndroidRuntime:java.lang.RuntimeException:无法启动活动ComponentInfo {com.rrapps.heavensdoor / com.rrapps.heavensdoor.PreviewActivity}:android.content.ActivityNotFoundException:未找到任何活动handle act = android.service.wallpaper.CHANGE_LIVE_WALLPAPER(有额外的)       在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2229)       在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2283)       在android.app.ActivityThread.access $ 600(ActivityThread.java:148)       在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1244)       在android.os.Handler.dispatchMessage(Handler.java:99)       在android.os.Looper.loop(Looper.java:151)       在android.app.ActivityThread.main(ActivityThread.java:5204)       at java.lang.reflect.Method.invokeNative(Native Method)       在java.lang.reflect.Method.invoke(Method.java:511)       在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:793)       在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)       at dalvik.system.NativeStart.main(Native Method)    引起:android.content.ActivityNotFoundException:找不到处理act的活动= android.service.wallpaper.CHANGE_LIVE_WALLPAPER(有附加内容)       在android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1627)       在android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)       在android.app.Activity.startActivityForResult(Activity.java:3424)       在android.app.Activity.startActivityForResult(Activity.java:3385)       at com.rrapps.heavensdoor.PreviewActivity.onCreate(Unknown Source)       在android.app.Activity.performCreate(Activity.java:5170)       在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)       在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2182)

以下是我设置壁纸的代码

        if (Build.VERSION.SDK_INT >= 16) {
        /*
         * Open live wallpaper preview (API Level 16 or greater).
         */
        intent.setAction(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
        String pkg = MyWallpaperService.class.getPackage().getName();
        String cls = MyWallpaperService.class.getCanonicalName();
        intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
                new ComponentName(pkg, cls));
    } else {
        /*
         * Open live wallpaper picker (API Level 15 or lower).
         *
         * Display a quick little message (toast) with instructions.
         */
        intent.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
        Resources res = getResources();
        String hint = res.getString(R.string.picker_toast_prefix)
                + res.getString(R.string.lwp_name)
                + res.getString(R.string.picker_toast_suffix);
        Toast toast = Toast.makeText(this, hint, Toast.LENGTH_LONG);
        toast.show();
    }

    startActivityForResult(intent, 0);

我不确定问题是什么。任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)

Android是一个有趣的世界,遗憾的是,隐含的意图比我们(开发者)希望的更多。特别适用于亚马逊设备,不需要遵守Google测试套件。在我的应用上,我看到ActivityNotFoundException尝试启动网络浏览器。

所以我的建议,即使它实际上没有解决问题,它只是尝试抓住它:

try{
   startActivityForResult(intent, 0);
} catch(ActivityNotFoundException e) {
   // why amazon, why?
}