Gmail错误“无法附加文件”

时间:2017-12-08 00:07:04

标签: android kotlin android-file file-sharing android-fileprovider

我正在尝试使用Gmail通过电子邮件发送PDF文件。但是,Gmail应用程序正在显示吐司:

  

无法附加档案

PDF文件未损坏,并在应用程序的缓存目录中成功生成。

代码:( 如果您需要Java代码,请在下面发表评论。)

grunt.initConfig({

    //Read the package.json (optional)
    pkg: grunt.file.readJSON('package.json'),

    // Cache bust css, update AppInsights key, remove all custom js imports from index.html, https url rewrites
    processhtml: {
        dev: {
            options: {
                data: {
                    appInsightsKey: 'f8d00249-dd60-44be-9145-dcb303e5fd19',
                    timestamp: Date.now()
                }
            },
            files:
            {
                'wwwroot/index2.html': ['wwwroot/index.html']
            }
        },
    },
    // Combine and minify all js in /app folder and subfolders into app.min.js
    uglify: {
        dev: {
            src: ['wwwroot/app/app.module.js', 'wwwroot/app/**/*.module.js', 'wwwroot/app/core/*.js', 'wwwroot/app/services/*.js', 'wwwroot/app/layout/*.js', 'wwwroot/app/**/*.js'],
            dest: 'wwwroot/app/app1.min.js'
        }
    },
    // Delete all js except for app.min.js in /app folder and subfolders
    clean: {
        dev: {
            options: {
                force: true
            },
            expand: true,
            src: ['app/**/*.js', '!app/app.min.js']
        }
    }
});

grunt.loadNpmTasks('grunt-processhtml');
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask("default", "watch");

// If no target provided, default to dev
var target = grunt.option('target') || 'dev';
//grunt.registerTask('default', ['processhtml:' + target, 'uglify:' + target, 'clean:' + target]);
grunt.registerTask('default', ['processhtml:' + target, 'uglify:' + target]);

请帮忙

1 个答案:

答案 0 :(得分:0)

根据Android文档,您需要在Intent构造函数中对附件使用ACTION.SEND intent动作。 Common Intents - Android Documentation

  

ACTION_SENDTO(无附件)或   ACTION_SEND(用于一个附件)或   ACTION_SEND_MULTIPLE(用于多个附件)