Android 库不是准确的版本?
Android libraries not exact version?
所以我正在制作一个可以将图像上传到服务器的应用程序,Web 服务很好并且 运行ning 并通过邮递员进行了测试。
在应用程序方面,当我尝试添加上传服务 3.4.2 的实现时,它向我显示错误,并且应用程序在上传时崩溃。
这是一张截图,我是新人,不允许添加图片,https://i.stack.imgur.com/s3s8x.png
我需要快速帮助。
这里是 运行 错误:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.simou.myapplication, PID: 5205
java.lang.RuntimeException: Unable to start service net.gotev.uploadservice.UploadService@c425f01 with Intent { act=net.gotev.uploadservice.action.upload cmp=com.simou.myapplication/net.gotev.uploadservice.UploadService (has extras) }: java.lang.IllegalArgumentException: Hey dude, please set the namespace for your app by following the setup instructions: https://github.com/gotev/android-upload-service/wiki/Setup
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3314)
at android.app.ActivityThread.-wrap21(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1565)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.IllegalArgumentException: Hey dude, please set the namespace for your app by following the setup instructions: https://github.com/gotev/android-upload-service/wiki/Setup
at net.gotev.uploadservice.UploadService.onStartCommand(UploadService.java:257)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3297)
如错误中所述,您需要为您的应用程序设置命名空间,前提是 library's wiki
public class Initializer extends Application {
@Override
public void onCreate() {
super.onCreate();
// setup the broadcast action namespace string which will
// be used to notify upload status.
// Gradle automatically generates proper variable as below.
UploadService.NAMESPACE = BuildConfig.APPLICATION_ID;
// Or, you can define it manually.
UploadService.NAMESPACE = "com.yourcompany.yourapp";
}
}
并将其注册到您的清单
<application
android:name=".Initializer"
...
>
所以我正在制作一个可以将图像上传到服务器的应用程序,Web 服务很好并且 运行ning 并通过邮递员进行了测试。 在应用程序方面,当我尝试添加上传服务 3.4.2 的实现时,它向我显示错误,并且应用程序在上传时崩溃。 这是一张截图,我是新人,不允许添加图片,https://i.stack.imgur.com/s3s8x.png 我需要快速帮助。
这里是 运行 错误:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.simou.myapplication, PID: 5205
java.lang.RuntimeException: Unable to start service net.gotev.uploadservice.UploadService@c425f01 with Intent { act=net.gotev.uploadservice.action.upload cmp=com.simou.myapplication/net.gotev.uploadservice.UploadService (has extras) }: java.lang.IllegalArgumentException: Hey dude, please set the namespace for your app by following the setup instructions: https://github.com/gotev/android-upload-service/wiki/Setup
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3314)
at android.app.ActivityThread.-wrap21(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1565)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.IllegalArgumentException: Hey dude, please set the namespace for your app by following the setup instructions: https://github.com/gotev/android-upload-service/wiki/Setup
at net.gotev.uploadservice.UploadService.onStartCommand(UploadService.java:257)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3297)
如错误中所述,您需要为您的应用程序设置命名空间,前提是 library's wiki
public class Initializer extends Application {
@Override
public void onCreate() {
super.onCreate();
// setup the broadcast action namespace string which will
// be used to notify upload status.
// Gradle automatically generates proper variable as below.
UploadService.NAMESPACE = BuildConfig.APPLICATION_ID;
// Or, you can define it manually.
UploadService.NAMESPACE = "com.yourcompany.yourapp";
}
}
并将其注册到您的清单
<application
android:name=".Initializer"
...
>