NativeScript / NativeScript/plugins

[@nativescript/background-http] packagename - illegal argument exception

オープン
#517 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
206
フォーク
123
平均マージ
2日 1時間
マージ済み PR(30日)
1

説明

Issue Description

Hi guys,

When I try to use your background http to upload a file,

I noticed I am getting :
Exception java.lang.RuntimeException: Unable to create service net.gotev.uploadservice.UploadService: java.lang.IllegalArgumentException: You have to set namespace to your app package name (context.packageName) in your Application subclass at android.app.ActivityThread.handleCreateService (ActivityThread.java:5086) at android.app.ActivityThread.-$$Nest$mhandleCreateService at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2428) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loopOnce (Looper.java:226) at android.os.Looper.loop (Looper.java:313) at android.app.ActivityThread.main (ActivityThread.java:8757) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067) Caused by java.lang.IllegalArgumentException: You have to set namespace to your app package name (context.packageName) in your Application subclass at net.gotev.uploadservice.UploadServiceConfig.getNamespace (UploadServiceConfig.kt:74) at net.gotev.uploadservice.UploadServiceConfig.getBroadcastNotificationAction (UploadServiceConfig.kt:234) at net.gotev.uploadservice.UploadServiceConfig.getBroadcastNotificationActionIntentFilter (UploadServiceConfig.kt:248) at net.gotev.uploadservice.observer.request.NotificationActionsObserver.register (NotificationActionsObserver.kt:31) at net.gotev.uploadservice.UploadService.onCreate (UploadService.kt:194) at android.app.ActivityThread.handleCreateService (ActivityThread.java:5073)

This is because in this file:
https://github.com/NativeScript/plugins/blob/main/packages/background-http/index.android.ts
line 30, we pass in the Utils.android.getApplication()
but the inner method is looking for Utils.android.getApplication().packageName, whereas we get the packageName by Utils.android.getApplication().getPackageName() which can be null/empty, not sure if this is a bug?

Reproduction
  1. uploadFile
  2. close the app and reopen
  3. app crash.
Relevant log output (if applicable)

No response

Environment

No response

Please accept these terms

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

packages/background-http/index.android.ts の30行目付近で、Utils.android.getApplication() が渡されている箇所から始め、レポートに記載されているパッケージ名へのアクセスとその値を比較します。uploadFile、終了、再起動のシーケンスを再現します。アプリが namespace IllegalArgumentException でクラッシュしなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, typescript
領域
mobile
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。