将我的android studio更新为3.1.1后 我在图片中发现了错误。 在我更新android studio之前一切都很好。
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;
public class SetTimeActivity extends AppCompatActivity {
private int TIME_IN_MINUTES ;
private EditText et ;
private Button mButtonStartPause;
private Button mButtonReset;
private CountDownTimer mCountDownTimer;
private boolean mTimerRunning;
private long mTimeLeftInMillis;
private long mEndTime;
DevicePolicyManager devicePolicyManager;
ComponentName componentName;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_set_time);
et = (EditText) findViewById(R.id.setTimerMenu_et);
mButtonStartPause = (Button) findViewById(R.id.set_btn);
devicePolicyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
componentName = new ComponentName(SetTimeActivity.this, Controller.class);
答案 0 :(得分:1)
尝试以下操作并检查其是否有效:
档案 - >使缓存无效并重新启动
打开命令行并执行手动gradle构建:
./ gradlew clean assemble
确保build.gradle中包含以下内容:
compile "com.android.support:appcompat-v7:{latest}"
答案 1 :(得分:0)
感谢您的回答,但我明白了, 因此,他们将依赖项添加到gradle 我们必须将“compile”替换为“implementation”,就像这样, 您可以在此URL中找到所需的一切:
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html?utm_source=android-studio#new_configurations