Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 通过WebView发布android上传_Java_Android_Android Webview - Fatal编程技术网

Java 通过WebView发布android上传

Java 通过WebView发布android上传,java,android,android-webview,Java,Android,Android Webview,我目前有这个基于webview的android应用程序,我目前的目标是能够通过webview上传图像。然而,当我单击Intellij中的Debug按钮时,我目前拥有的代码确实可以工作,当我单击upload按钮时,它可以完美地运行,并显示要从中选择要上载的应用程序。但是,当我签署Apk并构建它并准备发布时,它停止工作,因此我检查了应用程序出现的错误,并指出: java.lang.SecurityException: Permission Denial: get/set setting for u

我目前有这个基于webview的android应用程序,我目前的目标是能够通过webview上传图像。然而,当我单击Intellij中的Debug按钮时,我目前拥有的代码确实可以工作,当我单击upload按钮时,它可以完美地运行,并显示要从中选择要上载的应用程序。但是,当我签署Apk并构建它并准备发布时,它停止工作,因此我检查了应用程序出现的错误,并指出:

 java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
        at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13140)
        at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038)
        at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:607)
        at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
        at android.os.Binder.execTransact(Binder.java:388)
        at dalvik.system.NativeStart.run(Native Method)
因此,我所做的尝试是在清单中添加它所请求的权限,但这不起作用。下面是我目前用来尝试通过webview上传文件的代码

 @Override
protected void onActivityResult(int requestCode, int resultCode,
                                Intent intent) {
    if (requestCode == FILECHOOSER_RESULTCODE) {
        if (null == mUploadMessage)
            return;
        Uri result = intent == null || resultCode != RESULT_OK ? null
                : intent.getData();
        mUploadMessage.onReceiveValue(result);
        mUploadMessage = null;

    }
}

 public void openFileChooser(ValueCallback<Uri> uploadMsg) {

                mUploadMessage = uploadMsg;
                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                i.addCategory(Intent.CATEGORY_OPENABLE);
                i.setType("image/*");
                main.this.startActivityForResult(Intent.createChooser(i,"Image Chooser"), FILECHOOSER_RESULTCODE);
            }

            public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {
                openFileChooser(uploadMsg);
            }

            public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
                openFileChooser(uploadMsg);
            }

任何帮助都将不胜感激。这是我第一次遇到这个错误。另外,在我的应用程序中,除了上面的代码外,openFileChooser在其他任何地方都不会被调用。

如果必须解决此问题,我将从头开始。我注意到,在我更新到4.3之后,它停止工作。如果这有助于任何人,我发现错误是由pro guard引起的,所以为了解决这个问题,我在构建应用程序时禁用了pro guard。你找到解决方案了吗?这样我就可以用proguard上传了。