【问题标题】:Android Live Wallpaper crashes on Amazon App Store Testing ActivityNotFoundExceptionAndroid 动态壁纸在亚马逊应用商店测试 ActivityNotFoundException 上崩溃
【发布时间】:2015-05-08 04:05:37
【问题描述】:

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

03-06 06:00:50.741 7598 7598 E AndroidRuntime: 致命异常: main 03-06 06:00:50.741 7598 7598 E AndroidRuntime: java.lang.RuntimeException: 无法启动活动 ComponentInfo{com.rrapps.heavensdoor/com.rrapps.heavensdoor.PreviewActivity}: android.content.ActivityNotFoundException: 找不到活动处理 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) 在 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) 在 dalvik.system.NativeStart.main(本机方法) 原因: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) 在 com.rrapps.heavensdoor.PreviewActivity.onCreate(未知来源) 在 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);

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

【问题讨论】:

  • 这肯定会崩溃,因为 amazon fire os 不支持动态壁纸。

标签: android live-wallpaper amazon-appstore


【解决方案1】:

Android 是一个有趣的世界,不幸的是,隐含的意图比我们(开发人员)希望他们的变化更大。特别适用于不需要遵守谷歌测试套件的亚马逊设备。在我的应用程序中,我看到 ActivityNotFoundException 试图启动网络浏览器。

所以我的建议,即使它并没有真正解决问题,它只是尝试抓住它:

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

【讨论】:

  • "for testing on Amazon Developer site"是亚马逊人做的自动化测试还是手动测试?
  • 我猜是自动化测试
  • 我问这个是因为我想知道它是否是一个自动化测试,它可能是一个没有所有东西的模拟设备,所以它失败了。最终,您只能通过购买 Fire 平板电脑并对其进行测试来确定它是否有效,但如果它是自动化的,则很有可能在真实设备上运行良好。
  • 好的!但我无法使用真实设备 :( 但谢谢!
猜你喜欢
  • 2020-04-05
  • 2022-12-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-23
  • 1970-01-01
  • 2012-03-31
  • 1970-01-01
相关资源
最近更新 更多