Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.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
Android google plus图像上传帖子引发活动NotFoundException,图像Uri为_Android_Google Plus - Fatal编程技术网

Android google plus图像上传帖子引发活动NotFoundException,图像Uri为

Android google plus图像上传帖子引发活动NotFoundException,图像Uri为,android,google-plus,Android,Google Plus,当我试图用plusshare.builder将一张图片发布到googleplus时,我不断收到一个google+未安装错误。 为什么只有在我尝试发布图片时才发现该活动? 发布文本和内容URL将很好地工作,并拉动google+进行发布 我的活动: String gPlusSmallUrl = intent.getStringExtra("gPlusCropUrl"); String statusString = intent.getStringExtra("st

当我试图用plusshare.builder将一张图片发布到googleplus时,我不断收到一个google+未安装错误。 为什么只有在我尝试发布图片时才发现该活动? 发布文本和内容URL将很好地工作,并拉动google+进行发布

我的活动:

         String gPlusSmallUrl = intent.getStringExtra("gPlusCropUrl");
         String statusString = intent.getStringExtra("statusString");
            ContentResolver cr = this.getContentResolver();
            String mime = cr.getType(googleUri);

            Intent shareIntent = new PlusShare.Builder(this)
                    //.setType("text/plain") //posting with this works
                    .setText("example text here")// posting with this works
                    .addStream(googleUri)   //when i try to add an image it gives me a google+ not installed error
                    .setType(mime)// this is part of the failure too!
                    //.setContentUrl(Uri.parse(gPlusSmallUrl))//Posting with this also works fine.
                    .getIntent();
try {
                startActivityForResult(shareIntent, 0);
            } catch (ActivityNotFoundException e) {
                Toast.makeText(this, "You haven't installed google+ on your device", Toast.LENGTH_SHORT).show();
            }
            Log.i(TAG, "Posted to GooglePlus");

        }
        GooglePlusActivity.this.setResult(GOOGLE_LOGIN_RESULT_CODE_SUCCESS);
        finish();
    }
舱单: 权限:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_PROFILE" />

<meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

<activity
            android:name=".GooglePlusActivity"
            android:label="@string/title_activity_google_plus" >
        </activity>
        <intent-filter>
            <action android:name="android.intent.action.SEND" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>


我不明白为什么添加图像Uri会使它抛出
活动NotFoundException

您应该尝试.setstream而不是.addstream 也可以尝试使用image/*类型