Today, I updated Android Studio to 3.0, ran through the previous project, and encountered the following 6 potholes, which are summarized here.

  • Android Studio 3.0, the project SDK environment must be 26 or above. So:

    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    Copy the code
  • Gradle version, 3.0 or higher. So:

    classpath 'com. Android. Tools. Build: gradle: 3.0.1'
    Copy the code
  • Error:All flavors must now belong to a named flavor Dimension

    Build. Gradle in the main app

    DefaultConfig {targetSdkVersion: *** minSdkVersion: *** versionCode: *** versionName: ***// The flavor Dimension is the same as the version number
     flavorDimensions "versionCode"
    }
    
    Copy the code
  • Error: style attribute ‘@ android: attr/windowEnterAnimation’ not found

    * * error: style attribute ‘@ android: attr/windowExitAnimation’ not found. * * these two errors, copy of settlement:

    In the Project/gradle. Add android properties. EnableAapt2 = false

  • The project is imported without obvious errors. But when you click on the Run app, a screen appears with a red message below: Please select Android SDK, not working

    Solution: File > Project Structure > SDK Location > Use Embedded JDK(recommended) check

  • Error Running app:No target device found. Error Running app:No target device found What to do? The solution is simple:

    View > Tool Windows > Android Profilter

    Android Profilter was not started during Android Studio initialization and could not identify the device connected to the USB cable.