0
我卸載並安裝了再次安裝工作室由於在構建gradle上的一些錯誤。我已經創建併成功運行的項目,是現在不是我目前安裝studio.It紅印工作線AppCompatActivity,findViewById,startActivity等安裝生成工具25.0.3錯誤顯示在Android工作室,當我試圖運行我的舊安卓項目
完整的Java文件如下
package com.example.mfk.simpleloginapp;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class Login extends AppCompatActivity {
private static EditText username;
private static EditText password;
private static TextView attempts;
private static Button login_btn;
int attempt_counter = 5;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
LoginButton();
}
public void LoginButton()
{
username = (EditText)findViewById(R.id.editText4_Enter_UN_Here);
password = (EditText)findViewById(R.id.editText3_Enter_PW_Here);
attempts = (TextView) findViewById(R.id.editText5_Attmpts_see_here);
login_btn = (Button)findViewById(R.id.button2_Login);
attempts.setText(Integer.toString(attempt_counter));
login_btn.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
if(username.getText().toString().equals("mohammedfarisk")&&password.getText().toString().equals("[email protected]"))
{
Toast.makeText(Login.this,"Username and Password are correct",Toast.LENGTH_SHORT).show();
Intent intent = new Intent("com.example.mfk.user.User");
startActivity(intent);
}
else
{
Toast.makeText(Login.this,"Username or Password is NOT correct",Toast.LENGTH_SHORT).show();
attempt_counter--;
attempts.setText(Integer.toString(attempt_counter));
if(attempt_counter == 0)
{
login_btn.setEnabled(false);
}
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
//inflates the menu ; this adds items to the acion bar if it is present.
getMenuInflater().inflate(R.menu.menu_login, menu);
return true;
}
}
您是否安裝了構建工具25.0.3? – TofferJ
什麼是錯誤信息? – pchaigno
如何識別我是否安裝了構建工具25.0.3? –