安装失败并显示消息 Error: android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space [英] Installation failed with message Error: android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space

查看:402
本文介绍了安装失败并显示消息 Error: android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到消息

> Installation failed with message Failed to establish session.

因此,根据对问题的一些回应,我禁用了 Instant Run 并开始获得

so following some responses to the problem I disabled Instant Run and I started getting

> Installation failed with message Error: android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space.

我尝试过重建、清理项目、禁用和启用即时运行以及构建 APK,但没有解决问题.

I´ve tried rebuilding, cleaning the project, to disable and enable Instant Run and to build APK but nothing solves the problem.

这是我的 build.gradle(模块:app).

This is my build.gradle (Module:app).

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.gabriel.justmeet"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 9
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    useLibrary 'org.apache.http.legacy'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.volley:volley:1.1.0'
}

这是 build.gradle(Project)

and this is the build.gradle(Project)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
        maven { url 'http://repo1.maven.org/maven2' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'http://repo1.maven.org/maven2' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是在我修改 RegisterActivity 时开始的,所以它可能会有所帮助

This started when I modified my RegisterActivity, so it might help

package com.example.gabriel.paska;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;

import java.util.HashMap;
import java.util.Map;

public class RegisterActivity extends AppCompatActivity {
    public static final String REGISTER_URL ="http://justmeet.000webhostapp.com/php/register.php";
    public static final String KEY_USERNAME ="username";
    public static final String KEY_PASSWORD="password";
    public static final String KEY_NAME ="name";
    public static final String KEY_AGE="age";
    public static final String REGISTER_SUCCESS ="RegisterSuccess";
    public static final String SHARED_PREF_NAME="tech";
    public static final String USERNAME_SHARED_PREF="username";
    public static final String LOGGEDIN_SHARED_PREF="loggedin";
    private boolean loggedIn=false;
    EditText etAge;
    EditText etName;
    EditText etPassword;
    EditText etUsername;
    Button bRegister;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);

        etAge = findViewById(R.id.etAgeR);
        etName = findViewById(R.id.etNameR);
        etPassword = findViewById(R.id.etPwordR);
        etUsername = findViewById(R.id.etUsernameR);
        bRegister = findViewById(R.id.btRegister);

        bRegister.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                register();
            }
        });
    }
        private void register() {
            final String name = etName.getText().toString().trim();
            final String password = etPassword.getText().toString().trim();
            final String username = etUsername.getText().toString().trim();
            final String age = etAge.getText().toString().trim();

            StringRequest stringRequest = new StringRequest(Request.Method.POST, REGISTER_URL,
                    new Response.Listener<String>() {
                        @Override
                        public void onResponse(String response) {
                            if(response.trim().equalsIgnoreCase(REGISTER_SUCCESS)){

                                SharedPreferences sharedPreferences = RegisterActivity.this.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);

                                SharedPreferences.Editor editor = sharedPreferences.edit();

                                editor.putBoolean(LOGGEDIN_SHARED_PREF, true);
                                editor.putString(USERNAME_SHARED_PREF, name);

                                editor.apply();

                                Intent intent = new Intent(RegisterActivity.this, UserActivity.class);
                                startActivity(intent);
                            }else{
                                Toast.makeText(RegisterActivity.this, "Register Failed" + response.trim(), Toast.LENGTH_LONG).show();
                            }
                        }
                    },
                    new Response.ErrorListener() {
                        @Override
                        public void onErrorResponse(VolleyError error) {
                        }
                    }){
                @Override
                protected Map<String, String> getParams() throws AuthFailureError {
                    Map<String,String> prams = new HashMap<>();
                    prams.put(KEY_USERNAME, username);
                    prams.put(KEY_PASSWORD, password);
                    prams.put(KEY_NAME, name);
                    prams.put(KEY_AGE, age);

                    return prams;
                }
            };
            RequestQueue requestQueue = Volley.newRequestQueue(this);
            requestQueue.add(stringRequest);
        }
        @Override
        protected void onResume() {
            super.onResume();
            SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREF_NAME,Context.MODE_PRIVATE);
            loggedIn = sharedPreferences.getBoolean(LOGGEDIN_SHARED_PREF, false);
            if(loggedIn){
                Intent intent = new Intent(RegisterActivity.this, UserActivity.class);
                startActivity(intent);
            }
        }
    }

推荐答案

那个文件系统没有空间:

that file-system has no space:

java.io.IOException: Requested internal only, but not enough space.

问题是:

android:installLocation="internalOnly"

要么删除它,要么替换为:

either remove it, or replace it with:

android:installLocation="preferExternal"

<小时>

或者通过卸载或删除某些东西在设备/模拟器上腾出一些空间 -


or make some space on the device / emulator by uninstalled or deleting something -

或者简单地为虚拟 SD 卡分配更多兆字节.

or simply assign some more megabytes to the virtual SD card.

这篇关于安装失败并显示消息 Error: android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆