flutter – Problemas com gradle no android studio

Alguém sabe ou pode me ajudar com o seguinte erro ao pedir para iniciar um projeto em flutter no emulador do android studio:

Launching libmain.dart on Android SDK built for x86 in debug mode…
Running Gradle task ‘assembleDebug’…
Exception in thread “main” java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:225)
at java.util.zip.ZipFile.(ZipFile.java:155)
at java.util.zip.ZipFile.(ZipFile.java:169)
at org.gradle.wrapper.Install.unzip(Install.java:214)
at org.gradle.wrapper.Install.access$600(Install.java:27)
at org.gradle.wrapper.Install$1.call(Install.java:74)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Running Gradle task ‘assembleDebug’…
(!) Gradle threw an error while downloading artifacts from the network. Retrying to download…
Exception in thread “main” java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:225)
at java.util.zip.ZipFile.(ZipFile.java:155)
at java.util.zip.ZipFile.(ZipFile.java:169)
at org.gradle.wrapper.Install.unzip(Install.java:214)
at org.gradle.wrapper.Install.access$600(Install.java:27)
at org.gradle.wrapper.Install$1.call(Install.java:74)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
(!) Gradle threw an error while downloading artifacts from the network. Retrying to download…

android studio – Problema para abrir activity

estou tentando fazer uma lista horizontal com informações captadas de um pop up. Mas estou tendo dificuldades para fazer rodar o codigo. No emulador, ele abre o aplicativo e aparece o erro ao clicar na pagina em que esta o codigo.

Codigo da Lista que criei o que eu queria, criei com o GridLayout e ListView. A ideia é que a linha tenha 5 colunas. Esse layout eu inseri com o INCLUDE

    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:columnCount="5"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/grind_data"
        android:layout_marginLeft="10sp"
        android:layout_marginRight="10sp"
        android:textStyle="bold"
        android:text="Data"
        android:textSize="16sp"
        android:textColor="#000000"/>


    <TextView
        android:layout_marginLeft="10sp"
        android:layout_marginRight="10sp"
        android:textStyle="bold"
        android:text="Descrição"
        android:textSize="16sp"
        android:textColor="#000000"/>

    <TextView
        android:layout_marginLeft="10sp"
        android:layout_marginRight="10sp"
        android:textSize="16sp"
        android:text="R$ Saída"
        android:textStyle="bold"
        android:textColor="#000000"/>

    <TextView
        android:layout_marginLeft="10sp"
        android:layout_marginRight="10sp"
        android:textSize="16sp"
        android:text="R$ Entrada"
        android:textStyle="bold"
        android:textColor="#000000"/>

    <TextView
        android:layout_marginLeft="10sp"
        android:layout_marginRight="10sp"
        android:textSize="16sp"
        android:text="R$ Saldo"
        android:textStyle="bold"
        android:textColor="#000000"/>

    <ListView
        android:id="@+id/lv_data"
        android:layout_width="50dp"
        android:layout_height="wrap_content" />

    <ListView
        android:id="@+id/lv_desc"
        android:layout_width="50dp"
        android:layout_height="wrap_content" />

    <ListView
        android:id="@+id/lv_saida"
        android:layout_width="50dp"
        android:layout_height="wrap_content" />

    <ListView
        android:id="@+id/lv_entrada"
        android:layout_width="50dp"
        android:layout_height="wrap_content" />

    <ListView
        android:id="@+id/lv_saldo"
        android:layout_width="50dp"
        android:layout_height="wrap_content" />
</GridLayout```


**LAYOUT EM QUE É MINHA CLASS EXIBIDA**

```<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/drawer_layout"
    tools:context=".Dash">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <include
            layout="@layout/main_toolbar" />

        <TextView
            android:layout_width="386dp"
            android:layout_height="match_parent"
            android:text="Lançamentos"
            android:textAlignment="center"
            android:textSize="25sp"
            android:textStyle="bold" />

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_add" />

        <GridView
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </LinearLayout>

    <RelativeLayout
        android:layout_width="300dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@color/white">

        <include
            layout="@layout/main_nav_drawer"/>

    </RelativeLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <com.google.android.material.textfield.TextInputLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_marginTop="100dp"
            android:background="#353535"
            android:gravity="center_vertical"
            android:textColorHint="#FFFFFF"
            app:hintTextColor="@color/white"
            android:orientation="vertical">


            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/saldo_inicial"
                android:layout_width="200dp"
                android:layout_height="match_parent"
                android:fontFamily="@font/baloo"
                android:hint="Saldo inicial"
                android:inputType="numberDecimal"
                android:padding="12dp"
                android:shadowColor="#FFFFFF"
                android:textAlignment="inherit"
                android:textColor="#FFFFFF"
                android:textColorHighlight="#FFFFFF"
                android:textColorHint="#FFFFFF"
                android:textSize="20dp"/>


        </com.google.android.material.textfield.TextInputLayout>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="200dp">

        <ImageView
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:src="@drawable/ic_add"
            android:layout_marginEnd="8dp"
            android:gravity="center"/>


        <Button
            android:id="@+id/add_desp"
            android:layout_width="176dp"
            android:layout_height="50dp"
            android:layout_marginEnd="4dp"
            android:layout_marginStart="-5dp"
            android:layout_gravity="fill_vertical"
            android:padding="12dp"
            android:background="#F35252"
            android:textColor="@color/white"
            android:textStyle="bold"
            android:textSize="15sp"
            android:text="Adicionar despesa" />

        <Button
            android:id="@+id/add_rec"
            android:layout_width="176dp"
            android:layout_height="50dp"
            android:layout_marginEnd="4dp"
            android:layout_gravity="fill_vertical"
            android:padding="12dp"
            android:background="#6EEF73"
            android:textColor="#000000"
            android:textStyle="bold"
            android:textSize="15sp"
            android:text="Adicionar receita" />

    </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="280dp"
            android:gravity="center"
            android:orientation="vertical">

            <include
                layout="@layout/list">

            </include>


        </LinearLayout>```

**CODIGO CLASS**

```public class Dash extends AppCompatActivity {

    DrawerLayout drawerLayout;
    Button add_rec, add_desp,btn_adc_rec,btn_adc_desp;
    Dialog epicDialog;
    ImageView close_popup_receita, close_popup_despesa;
    TextView tv_adc_rec, tv_adc_desp;
    EditText input_venc_rec,input_descricao_rec;
    TextInputEditText input_venc_desp,input_descricao_desp,input_valor_rec,input_valor_desp;


    ArrayList<Integer> listadesc;
    ArrayAdapter<Integer> adapter;
    ListView lv_data,lv_desc;


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

        input_venc_rec = findViewById(R.id.input_venc_rec);

        //LISTVIEW =====================================================================================
        lv_data = findViewById(R.id.lv_data);
        lv_desc = (ListView) findViewById(R.id.lv_desc);
        btn_adc_desp = (Button) findViewById(R.id.btn_adc_desp);
        btn_adc_rec = (Button) findViewById(R.id.btn_adc_rec);
        input_descricao_rec = (EditText) findViewById(R.id.input_descricao_rec);

        //DATA

        listadesc = new ArrayList<>();
        adapter = new ArrayAdapter<>(this,
                android.R.layout.simple_list_item_1,listadesc);
        lv_desc.setAdapter(adapter);

        btn_adc_rec.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int descrição = Integer.parseInt(input_descricao_rec.getText().toString());
                listadesc.add(descrição);
                adapter.notifyDataSetChanged();
            }
        });```

**ERRO AO TENTAR ABRIR NO EMULADOR** 

>E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.nubolso, PID: 9086
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.nubolso/com.example.nubolso.Dash}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6541)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
        at com.example.nubolso.Dash.onCreate(Dash.java:59)
        at android.app.Activity.performCreate(Activity.java:6975)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
        at android.os.Handler.dispatchMessage(Handler.java:105) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6541) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

java – Android Studio Socket.io disconnecting and reconnecting every few seconds

I have a setup right now where I am running a flask server that handles websocket communication between and android phone and a raspberry pi node.js socket.io client. The android socket.io can connect to the flask server, the node.js client can connect, and I can emit messages between all 3, however my android studio socket.io client is disconnecting every 5-10 seconds and reconnecting. It continues to do this even when I leave the activity that causes it to connect, it will connect and disconnect from the server continuously. Here is the Java code in android studio:

import io.socket.client.IO;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;


public class ControlPage extends AppCompatActivity {
    Button greenButton;
    Button redButton;
    private Socket mSocket; {
        try {
            mSocket = IO.socket("http://192.168.1.2:5000");
        } catch (URISyntaxException e) {}
    }
    //private EditText mInputMessageView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_control_page);
        mSocket.connect();
        mSocket.on(Socket.EVENT_CONNECT, onConnect);
        greenButton = (Button) findViewById(R.id.sendButtonGreen);
        greenButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                attemptSendGreen();
            }
        });
        redButton = (Button) findViewById(R.id.sendButtonRed);
        redButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                attemptSendRed();
            }
        });
    }

Server side in my flask code I have:

import flask
from flask_socketio import SocketIO, emit
from flask import request
import json

app = flask.Flask(__name__)
socketio = SocketIO(app)
clients = {}
sessions = {}

@app.route('/')
def hello():
    return "<h1> Hello World! </h1>"
    
@socketio.on('connect')
def testConnect():
    print('connected')
    emit('connected')

    
@socketio.on('disconnect')
def testDisconnect():
    userSID = request.sid
    print('disconnected ' + str(userSID))
    UserID = sessions(str(userSID))(0)
    UserType = sessions(str(userSID))(1)
    clients(UserID)(UserType)=''
    sessions.pop(str(userSID))
        
@socketio.on('config')
def handle_config(data):
    print('received message: ' + str(data)+ str(type(data)))
    userSID = request.sid
    if type(data) == str:
        jsonData = eval(data)
    else:
        jsonData = data
    print(userSID)
    if jsonData('USER_KEY') in clients:
        clients(jsonData('USER_KEY'))(jsonData('USER_TYPE'))=userSID
    else:
        clients(jsonData('USER_KEY')) = {'USER':'',
                                     'HARDWARE':''}
        clients(jsonData('USER_KEY'))(jsonData('USER_TYPE'))=userSID
    sessions(str(userSID)) = (jsonData('USER_KEY'), jsonData('USER_TYPE'))

@socketio.on('transfer')
def transfer(data):
    jsonData = eval(data)
    print(jsonData)
    UserID = jsonData('USER_KEY')
    UserType = jsonData('USER_TYPE')
    color = jsonData('MESSAGE')
    #message = data('MESSAGE')
    message = {'COLOR': color,
               'STATE': 1
        }
    jsonMessage = json.dumps(message)
    
    if UserType == 'USER':
        transferID = clients(UserID)('HARDWARE')
    else: 
        transferID = clients(UserID)('USER')
    emit('serverTransfer', jsonMessage, to=transferID)

socketio.run(app,host='192.168.1.2',port='5000') #remove this line when using gunicorn deployment

Everything server side is working fine with my node.js client, so I don’t think that the problem is coming from the server.

This is the information I get back from my server that shows the android client disconnecting and reconnecting every few seconds:

WebSocket transport not available. Install eventlet or gevent and gevent-websocket for improved performance.
 * Serving Flask app "websocketTest" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://192.168.1.2:5000/ (Press CTRL+C to quit)
192.168.1.5 - - (18/Apr/2021 18:15:23) "GET /socket.io/?EIO=4&transport=polling HTTP/1.1" 200 -
192.168.1.5 - - (18/Apr/2021 18:15:23) "POST /socket.io/?EIO=4&transport=polling&sid=mO35rQ0Mi_5ZxYFXAAAA HTTP/1.1" 200 -
192.168.1.5 - - (18/Apr/2021 18:15:23) "GET /socket.io/?EIO=4&transport=polling&sid=mO35rQ0Mi_5ZxYFXAAAA HTTP/1.1" 200 -
192.168.1.5 - - (18/Apr/2021 18:15:23) "POST /socket.io/?EIO=4&transport=polling&sid=mO35rQ0Mi_5ZxYFXAAAA HTTP/1.1" 200 -
connected
received message: { "USER_KEY": "TEST_USER", "MESSAGE": "asdfasdfasdf", "USER_TYPE":"USER"}<class 'str'>
6pKGg55-qcP9rejgAAAB
192.168.1.5 - - (18/Apr/2021 18:15:33) "POST /socket.io/?EIO=4&transport=polling&sid=mO35rQ0Mi_5ZxYFXAAAA HTTP/1.1" 200 -
192.168.1.5 - - (18/Apr/2021 18:15:33) "GET /socket.io/?EIO=4&transport=polling&sid=mO35rQ0Mi_5ZxYFXAAAA HTTP/1.1" 200 -
disconnected6pKGg55-qcP9rejgAAAB
192.168.1.6 - - (18/Apr/2021 18:15:33) "GET /socket.io/?EIO=4&transport=polling&t=NZdidCS&b64=1 HTTP/1.1" 200 -
192.168.1.6 - - (18/Apr/2021 18:15:34) "POST /socket.io/?EIO=4&transport=polling&t=NZdidEm&b64=1&sid=6pJ6UIkNrvOanjMwAAAC HTTP/1.1" 200 -
192.168.1.6 - - (18/Apr/2021 18:15:34) "GET /socket.io/?EIO=4&transport=polling&t=NZdidEx&b64=1&sid=6pJ6UIkNrvOanjMwAAAC HTTP/1.1" 200 -
192.168.1.6 - - (18/Apr/2021 18:15:34) "POST /socket.io/?EIO=4&transport=polling&t=NZdidFW&b64=1&sid=6pJ6UIkNrvOanjMwAAAC HTTP/1.1" 200 -
192.168.1.6 - - (18/Apr/2021 18:15:34) "POST /socket.io/?EIO=4&transport=polling&t=NZdidFx&b64=1&sid=6pJ6UIkNrvOanjMwAAAC HTTP/1.1" 200 -
connected
received message: {'USER_KEY': 'TEST_USER', 'USER_TYPE': 'HARDWARE'}<class 'dict'>
1nrEBb6Xny3dpELEAAAD
192.168.1.5 - - (18/Apr/2021 18:15:35) "GET /socket.io/?EIO=4&transport=polling HTTP/1.1" 200 -
192.168.1.5 - - (18/Apr/2021 18:15:35) "POST /socket.io/?EIO=4&transport=polling&sid=Vo6Qo1Suk5U6dnG0AAAE HTTP/1.1" 200 -
192.168.1.5 - - (18/Apr/2021 18:15:35) "GET /socket.io/?EIO=4&transport=polling&sid=Vo6Qo1Suk5U6dnG0AAAE HTTP/1.1" 200 -
192.168.1.5 - - (18/Apr/2021 18:15:35) "POST /socket.io/?EIO=4&transport=polling&sid=Vo6Qo1Suk5U6dnG0AAAE HTTP/1.1" 200 -
connected
received message: { "USER_KEY": "TEST_USER", "MESSAGE": "asdfasdfasdf", "USER_TYPE":"USER"}<class 'str'>
85Gy1EZr-XWm32-6AAAF
192.168.1.5 - - (18/Apr/2021 18:15:39) "POST /socket.io/?EIO=4&transport=polling&sid=Vo6Qo1Suk5U6dnG0AAAE HTTP/1.1" 200 -
192.168.1.6 - - (18/Apr/2021 18:15:39) "GET /socket.io/?EIO=4&transport=polling&t=NZdidFj&b64=1&sid=6pJ6UIkNrvOanjMwAAAC HTTP/1.1" 200 -
{'USER_KEY': 'TEST_USER', 'MESSAGE': 'GREEN', 'USER_TYPE': 'USER'}
192.168.1.6 - - (18/Apr/2021 18:15:40) "GET /socket.io/?EIO=4&transport=polling&t=NZdieaT&b64=1&sid=6pJ6UIkNrvOanjMwAAAC HTTP/1.1" 200 -
192.168.1.5 - - (18/Apr/2021 18:15:40) "POST /socket.io/?EIO=4&transport=polling&sid=Vo6Qo1Suk5U6dnG0AAAE HTTP/1.1" 200 -
{'USER_KEY': 'TEST_USER', 'MESSAGE': 'GREEN', 'USER_TYPE': 'USER'}
192.168.1.5 - - (18/Apr/2021 18:15:41) "POST /socket.io/?EIO=4&transport=polling&sid=Vo6Qo1Suk5U6dnG0AAAE HTTP/1.1" 200 -
192.168.1.6 - - (18/Apr/2021 18:15:41) "GET /socket.io/?EIO=4&transport=polling&t=NZdiejT&b64=1&sid=6pJ6UIkNrvOanjMwAAAC HTTP/1.1" 200 -
{'USER_KEY': 'TEST_USER', 'MESSAGE': 'RED', 'USER_TYPE': 'USER'}
192.168.1.5 - - (18/Apr/2021 18:15:42) "POST /socket.io/?EIO=4&transport=polling&sid=Vo6Qo1Suk5U6dnG0AAAE HTTP/1.1" 200 -
192.168.1.6 - - (18/Apr/2021 18:15:42) "GET /socket.io/?EIO=4&transport=polling&t=NZdif2X&b64=1&sid=6pJ6UIkNrvOanjMwAAAC HTTP/1.1" 200 -
{'USER_KEY': 'TEST_USER', 'MESSAGE': 'RED', 'USER_TYPE': 'USER'}
192.168.1.5 - - (18/Apr/2021 18:15:45) "POST /socket.io/?EIO=4&transport=polling&sid=Vo6Qo1Suk5U6dnG0AAAE HTTP/1.1" 200 -
192.168.1.5 - - (18/Apr/2021 18:15:45) "GET /socket.io/?EIO=4&transport=polling&sid=Vo6Qo1Suk5U6dnG0AAAE HTTP/1.1" 200 -
disconnected85Gy1EZr-XWm32-6AAAF
192.168.1.5 - - (18/Apr/2021 18:15:47) "GET /socket.io/?EIO=4&transport=polling HTTP/1.1" 200 -
192.168.1.5 - - (18/Apr/2021 18:15:47) "POST /socket.io/?EIO=4&transport=polling&sid=Axb2tK8BaYqGqrgGAAAG HTTP/1.1" 200 -
192.168.1.5 - - (18/Apr/2021 18:15:47) "GET /socket.io/?EIO=4&transport=polling&sid=Axb2tK8BaYqGqrgGAAAG HTTP/1.1" 200 -
192.168.1.5 - - (18/Apr/2021 18:15:47) "POST /socket.io/?EIO=4&transport=polling&sid=Axb2tK8BaYqGqrgGAAAG HTTP/1.1" 200 -
connected
received message: { "USER_KEY": "TEST_USER", "MESSAGE": "asdfasdfasdf", "USER_TYPE":"USER"}<class 'str'>
RLGgcjYRr3G8437zAAAH
192.168.1.6 - - (18/Apr/2021 18:15:58) "GET /socket.io/?EIO=4&transport=polling&t=NZdifE4&b64=1&sid=6pJ6UIkNrvOanjMwAAAC HTTP/1.1" 200 -
disconnected1nrEBb6Xny3dpELEAAAD
192.168.1.5 - - (18/Apr/2021 18:16:12) "GET /socket.io/?EIO=4&transport=polling&sid=Axb2tK8BaYqGqrgGAAAG HTTP/1.1" 200 -
disconnectedRLGgcjYRr3G8437zAAAH

The library I’m using to handle my socket.io in Java is imported as:

    implementation ('io.socket:socket.io-client:2.0.0') {
        exclude group: 'org.json', module: 'json'
    }

Any insight into what is causing my android client to disconnect would be greatly appreciated.

Our Studio will build, launch and advertise your shopify store for $12

Our Studio will build, launch and advertise your shopify store

Are you looking for a a team that can help you create and launch your Shopify website?

We are Startup Slang, a Shopify partner studio from Toronto, Canada!

Startup Slang is a team of Shopify Experts focused on offering excellence here on Fiverr. Our services are focused on assisting you as eCommerce entrepreneurs to setup, design and launch high converting Shopify stores.

We have worked with some of the largest brands on this platform, including companies like Dyson, Panasonic and Amnesty International. Our professional work has been able to assist over 1000 companies scale and we are today a team of over 35 Canadian professionals.

Shopify stores that we have created have generated well over $100 Million in revenue.

We can setup, configure, customize, and design your Shopify stores according to the best industry standards and to meet all of your needs.

.

Android Studio – datos no se muestran en recyclerview

Estoy creando una aplicación donde la página principal está dividida en 2 tabs. Quiero mostrar los datos de un JSON, he probado en otro proyecto (poniendo todo en el main, sin tabs ni en fragmentos), y muestra los datos correctamente. El problema viene cuando intento hacer lo mismo en un fragmento.

No veo el problema por ningún lado, he consultado y mirado por diferentes sitios, pero sigo sin encontrar el error, al lanzar la aplicación el tab donde debería de aparecer la información se muestra vacío.

El Log muestra los nombres e imágenes del JSON correctamente, así que el error creo que es a la hora de intentar mostrarlos.

SurvisFragment:

@Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState)
    {
        return inflater.inflate(R.layout.fragment_personajes_survis, container, false);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState)
    {
        super.onActivityCreated(savedInstanceState);
        mViewModel = new ViewModelProvider(this).get(SurvisViewModel.class);
        // TODO: Use the ViewModel

        configView();
    }

    private void configView()
    {
        initializeComponents();
        getSurvis("https://api.npoint.io/840b16c025f4b9eaa1f0");
    }

    private void initializeComponents()
    {
        recyclerView = getActivity().findViewById(R.id.recyclerViewPersonajes);
        recyclerView.setLayoutManager(new GridLayoutManager(mContext, 3));
    }

    private void getSurvis(String url)
    {
        pd = new ProgressDialog(getContext());
        pd.setMessage("Cargando personajes...");
        pd.show();

        StringRequest request = new StringRequest(Request.Method.GET, url, new com.android.volley.Response.Listener<String>()
        {
            @Override
            public void onResponse(String response)
            {
                pd.dismiss();

                try
                {
                    JSONObject object = new JSONObject(response);
                    JSONArray array = object.getJSONArray("personajes");
                    for (int i = 0; i < array.length(); i++)
                    {
                        JSONObject object1 = array.getJSONObject(i);
                        if (object1.getString("Tipo").equals("Superviviente"))
                        {
                            data.add(
                                    new Personaje(
                                            object1.getString("Nombre"),
                                            object1.getString("Imagen")
                                    )
                            );

                            Log.e("PERSONAJES ", data.get(i).getNombre() + " - " + data.get(i).getImagen());

                        }
                    }

                    setPersonajes(data);

                } catch (JSONException e)
                {
                    e.printStackTrace();
                }
            }
        }, new Response.ErrorListener()
        {
            @Override
            public void onErrorResponse(VolleyError error)
            {
                pd.dismiss();
                Log.e("ERROR", "Error occurred " + error.getMessage());
            }
        });

        Volley.newRequestQueue(mContext).add(request);

    }

    private void setPersonajes(ArrayList<Personaje> data)
    {
        Log.i("ELEMENTOS", "Elementos a cargar " + data.size());
        personajesAdapter = new PersonajesAdapter(mContext, data);
        personajesAdapter.notifyDataSetChanged();
        recyclerView.setAdapter(personajesAdapter);
    }

PersonajesAdapter:

public class PersonajesAdapter extends RecyclerView.Adapter<PersonajesAdapter.ViewHolder>
{
    Context context;
    ArrayList<Personaje> data;

    public PersonajesAdapter(Context context, ArrayList<Personaje> data)
    {
        this.context = context;
        this.data = data;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
    {
        return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.fragment_personajes, null));
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position)
    {
        Glide.with(context).asBitmap().load(data.get(position).getImagen()).into(holder.image);

        holder.name.setText(data.get(position).getNombre());
    }

    @Override
    public int getItemCount()
    {
        return data.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder
    {
        ImageView image;
        TextView name;

        public ViewHolder(@NonNull View itemView)
        {
            super(itemView);
            image = itemView.findViewById(R.id.image);
            name = itemView.findViewById(R.id.name);
        }
    }

    public Context getContext()
    {
        return context;
    }

    public void setContext(Context context)
    {
        this.context = context;
    }

    public ArrayList<Personaje> getData()
    {
        return data;
    }

    public void setData(ArrayList<Personaje> data)
    {
        this.data = data;
    }

fragment_personajes_survis.xml

<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:theme="@style/Theme.MaterialComponents.Light"
    app:cardCornerRadius="7dp"
    app:cardElevation="4dp"
    android:padding="7dp">

    <LinearLayout
        android:id="@+id/layoutProducto"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:orientation="vertical">

        <androidx.cardview.widget.CardView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:cardCornerRadius="8dp">

            <ImageView
                android:id="@+id/image"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:scaleType="centerCrop" />

        </androidx.cardview.widget.CardView>

        <TextView
            android:id="@+id/name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/image"
            android:layout_marginTop="10dp"
            android:ellipsize="end"
            android:lines="2"
            android:text="DWIGHT FAIRFIELD"
            android:textAlignment="center"
            android:textColor="#363636"
            android:textSize="14sp"
            android:textStyle="bold" />

    </LinearLayout>

</com.google.android.material.card.MaterialCardView>

Android Studio IDE: I want to prevent the last executed Gradle task from being default run configuration

I have a custom gradle task that clean, build and copy the output apk to a certain location to release the apk to my customers.

However, every time I run the custom gradle task, the run configuration of Android Studio IDE is changed to that gradle task.

For example,

enter image description here

This is changed as the following picture after running the task.
(In this picture I use gradle clean for example)

enter image description here

Thus, if I forgot to change back the configuration to default app module and ‘run (Shift + F10 in Windows)’, the task is running again unexpectedly and it struck me.

After an hour of googling, I couldn’t found a solution for this. Is there a way to prevent this behavior?

Python Visual Studio Code – Stack Overflow en español

tengo un problemas…cuando quiero ejecutar algo no me deja y me saca todo malo, aparte me pide una extensión a Python y no me arregla nada eso, necesito resolver ese programa hasta he intentado descargar de nuevo e instalar los paquetes que me pide

c# – Visual Studio not recognizing Unity’s new Input system

I’m attempting to learn Unity’s new input system, but when I try to add using UnityEngine.InputSystem; to my code it getsa red squiggly line under it. It doesn’t cause any compiler errors, but it’s very annoying. How do i get Visual Studio to recognize this so Intellisense will work again?

java – Guardar información de un spinner a una base de datos SQLite Android Studio

he escuchado que desde una BD se puede rellenar un spinner ¿pero cómo lo hago al revés? no encuentro información acerca de un spinner ya hecho y con base de lo ya seleccionado pueda almacenarlo en mi Base de Datos SQLite en Android Studio, por si acaso, uso java y lo necesito para después mostrarlo en un TextView en otra activity pero no sé cómo.. Me ayudan?

8 – Is it possible to use only one module for multiple Site Studio (Cohesion) elements?

I’m creating custom elements to use within Acquia Site Studio/Cohesion (following this), but one majorly inconvenient thing is that you have to create a whole new module for each element. I’m trying to integrate an entire preexisting design system with several components, so registering and enabling modules for each of them is a bit of a pain.

I noticed that all of Site Studio’s stock elements use only one module, so it gave me the idea to do the same. However, those elements aren’t like custom ones, in the sense that they’re retrieved from an API and the markup is generated at runtime. So I can’t exactly just follow the same process.

So far what I’ve tried is creating a single “Components Package” module, then defining multiple classes for each element inside the src/Plugin/CustomElement/ComponentPackage.php file. But the class has to match the file name, so that doesn’t work.

I’ve read through all of Acquia’s documentation and there’s nothing that addresses this, so I fear it may not be possible. But their documentation lacks in several areas, so maybe it is. Any help would be much appreciated.