Android库不是确切的版本?

时间:2018-04-04 09:47:29

标签: android android-gradle build.gradle libraries

所以我正在创建一个可以将图像上传到服务器的应用程序,Web服务很好并且正在运行并使用邮递员进行测试。 在应用程序方面,当我尝试添加上传服务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)

1 个答案:

答案 0 :(得分:0)

如错误中所述,您需要将应用程序的命名空间设置为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"
    ...
>