简体   繁体   English

Android Studio版本3.1.1

[英]android studio version 3.1.1

After updating my android studio to 3.1.1 I found the error in the picture. 将我的android studio更新到3.1.1后,我在图片中发现错误。 Before I updated android studio everything was fine. 在我更新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);

在此处输入图片说明

Try the following and check if it works : 请尝试以下操作,并检查其是否有效:

  1. Try to invalidate caches and restart. 尝试使缓存无效并重新启动。 For this : 为了这 :

File -> Invalidate Caches and Restart 文件->使缓存无效并重新启动

  1. Open up your command line and perform a manual gradle build : 打开命令行并执行手动Gradle构建:

    ./gradlew clean assemble ./gradlew清洁组装

  2. Make sure you have the following in your build.gradle : 确保您的build.gradle中包含以下内容:

     compile "com.android.support:appcompat-v7:{latest}" 

Thank you for your answer but I got it Now, So they add dependencies to the gradle and we have to replace "compile" with "implementation", something like this , you can find everything you need in this URL : 谢谢您的回答,但我明白了,所以他们将依赖项添加到了gradle中,我们必须将“ c​​ompile”替换为“ implementation”,诸如此类,您可以在此URL中找到所需的一切:

https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html?utm_source=android-studio#new_configurations https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html?utm_source=android-studio#new_configurations

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM