我是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'
我只想解决此问题并让应用程序在模拟器上运行,以便可以将其转移到手机上并在课堂上进行演示