1

我是 android 开发的新手,正在尝试为我的班级项目开发一个 android 食品订购应用程序。我没有编码背景,正在使用 Youtube 和 Udacity 的 Android 应用程序开发课程开发应用程序。但是,每当我尝试在 android 模拟器中查看我的应用程序的进度时,我都会遇到某种形式的错误,这让我无法看到我的应用程序在模拟器上的样子。我面临的最新问题是

com.google.android.instantapps.sdk.lib.AdbHelper$AdbCommandException: ADB 
command timed out: [shell, pm dump com.example.broncogrill]
Command output:

Error while Uploading and launching Instant App

我无法理解为什么会出现这个问题。我的代码是否有问题,或者模拟器是否存在其他问题,不允许我上传和启动应用程序?

我试过禁用即时运行,但没有奏效。然后我尝试将连接超时从 5,000 毫秒增加到 50,000 毫秒。

 package com.example.broncogrill;

 import android.graphics.Typeface;
 import android.os.Bundle;

 import 
 com.google.android.material.floatingactionbutton.FloatingActionButton;
 import com.google.android.material.snackbar.Snackbar;

 import androidx.appcompat.app.AppCompatActivity;
 import androidx.appcompat.widget.Toolbar;

 import android.view.View;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.widget.Button;
 import android.widget.TextView;

 public class MainActivity extends AppCompatActivity {

 Button btnSignIn, btnSignUp;
 TextView txtSlogan;


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

     btnSignIn = (Button)findViewById(R.id.btnSignIn);
     btnSignUp = (Button)findViewById(R.id.btnSignUp);

     txtSlogan = (TextView)findViewById(R.id.txtSlogan);
     Typeface face = 
     Typeface.createFromAsset(getAssets(),"fonts/NABILA.TTF");
     txtSlogan.setTypeface(face);

     btnSignIn.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View v) {

         }
     });

     btnSignUp.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View v) {

         }
     });

     Toolbar toolbar = findViewById(R.id.toolbar);
     setSupportActionBar(toolbar);

     FloatingActionButton fab = findViewById(R.id.fab);
     fab.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View view) {
             Snackbar.make(view, "Replace with your own action", 
                     Snackbar.LENGTH_LONG)
                     .setAction("Action", null).show();
         }
     });
 }

 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
     // Inflate the menu; this adds items to the action bar if it is present.
     getMenuInflater().inflate(R.menu.menu_main, menu);
     return true;
 }

 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
     // Handle action bar item clicks here. The action bar will
     // automatically handle clicks on the Home/Up button, so long
     // as you specify a parent activity in AndroidManifest.xml.
     int id = item.getItemId();

     //noinspection SimplifiableIfStatement
     if (id == R.id.action_settings) {
         return true;
     }

     return super.onOptionsItemSelected(item);
 }
 }

build.gradle

   apply plugin: 'com.android.application'

    android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.broncogrill"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    }

    dependencies {
    implementation 'com.github.jd-alexander:android-flat-button:v1.1'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:25.1.0'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
    implementation 'com.google.android.material:material:1.0.0-beta01'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0- 
    alpha4'

    // Add Libraries
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.firebase:firebase-database:16.0.6'

    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    }
    apply plugin: 'com.google.gms.google-services'

我只是想解决这个问题并让应用程序在模拟器上运行,以便我可以将它传输到我的手机并在我的课堂上进行演示

4

0 回答 0